{"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"provenance":[{"file_id":"1767oIEP3DHrNUpfBrghX0LfBkUG_GFFt","timestamp":1742998078684}],"gpuType":"T4"},"kernelspec":{"name":"python3","display_name":"Python 3"},"language_info":{"name":"python"}},"cells":[{"cell_type":"markdown","metadata":{"id":"aHwG3F-gx-ko"},"source":["\n","\n","### **Lab 1.1? - Ngram model** - To comment - **Jonathan** Incorporate 2 new activities - random choice 2 + count zero **Annie**\n","\n","[Possibly part of the Instructions Page]\n","\n","**Introduction**\n","\n","In this lab, we will build an n-gram model. An n-gram is a contiguous sequence of *n* words. An n-gram *model* uses these sequences to predict the probability of the next word given a preceding sequence of n-1 words (the context). We'll use the conditional probability formula:\n","\n"," **Formula**\n","\n","$$ P(\\text{B} \\mid \\text{A}) = \\frac{\\text{Count(A B)}}{\\text{Count(A)}} $$\n","\n","where:\n","\n","*  $P(B|A)$ is the probability of word B following word A.\n","* $\\text{Count(A B)}$ is the number of times the sequence \"A and B\" appear together in the text.\n","* $\\text{Count(A)}$ is the number of times word A appears in the text.\n","\n","**Steps**\n","\n","1. **Data Preparation:** Define your dataset and break the sentences into individual words (also called tokenization).\n","\n","2. **N-gram Creation:**  Create n-grams from the tokenized words and calculate the numerator of our formula: $\\text{Count(A B)}$.\n","\n","3. **Probability Calculation:** Calculate the denominator: $\\text{Count(A)}$. Divide the numerator (from Step 2) by the denominator to get $P(B|A)$.\n","\n","4. **Text Generation:** Use the calculated probabilities to generate new text based on the n-gram model. The last step also involves a coding activity.\n","\n","So let's begin!"]},{"cell_type":"markdown","source":["\n","\n","**Step 1: Define dataset and break sentences into individual words.**\n","\n","Let's define the corpus (text) we will use for this exercise. We will use the TinyStories dataset which comprises of synthetically generated short stories with a limited vocabulary.\n","\n","*Run the following code cells by clicking on the play button*"],"metadata":{"id":"1rTj9QNCr2NC"}},{"cell_type":"code","source":["from IPython.display import clear_output\n","# !pip install datasets\n","# from datasets import load_dataset\n","from collections import Counter, defaultdict\n","import pandas as pd\n","import random\n","from google.colab import drive\n","import sys\n","import os\n","import pandas as pd\n","\n","clear_output()  # Clears the output"],"metadata":{"id":"r8pisvnSgRPD","executionInfo":{"status":"ok","timestamp":1743432871707,"user_tz":240,"elapsed":2389,"user":{"displayName":"Vishal Patel","userId":"10042835130614330420"}}},"execution_count":1,"outputs":[]},{"cell_type":"code","source":["# @title Run me to mount drive\n","from google.colab import drive\n","drive.mount('/content/drive/', force_remount=True)\n","\n","path='/content/drive/MyDrive/A&T_workshop/data'\n","\n","import sys\n","\n","sys.path.append(path)\n","import os\n","os.chdir(path)\n","!pwd\n","\n","import pandas as pd\n","\n","stories=pd.read_json('africa_galore.json')\n","stories =stories['description']\n","stories[0]"],"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":245},"id":"Pa22xutOAiTx","outputId":"0cd48a44-a362-422d-ab0a-087bc8d08d8f","executionInfo":{"status":"error","timestamp":1743432924150,"user_tz":240,"elapsed":27893,"user":{"displayName":"Vishal Patel","userId":"10042835130614330420"}}},"execution_count":3,"outputs":[{"output_type":"stream","name":"stdout","text":["Mounted at /content/drive/\n"]},{"output_type":"error","ename":"FileNotFoundError","evalue":"[Errno 2] No such file or directory: '/content/drive/MyDrive/A&T_workshop/data'","traceback":["\u001b[0;31m---------------------------------------------------------------------------\u001b[0m","\u001b[0;31mFileNotFoundError\u001b[0m                         Traceback (most recent call last)","\u001b[0;32m<ipython-input-3-a0c7d22c66e9>\u001b[0m in \u001b[0;36m<cell line: 0>\u001b[0;34m()\u001b[0m\n\u001b[1;32m      9\u001b[0m \u001b[0msys\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpath\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mpath\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     10\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mos\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 11\u001b[0;31m \u001b[0mos\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mchdir\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mpath\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m     12\u001b[0m \u001b[0mget_ipython\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msystem\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'pwd'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     13\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n","\u001b[0;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: '/content/drive/MyDrive/A&T_workshop/data'"]}]},{"cell_type":"code","source":["for story in stories:\n","  print(story)\n","  print('-------------------')"],"metadata":{"id":"IRYzvOkxCILc","executionInfo":{"status":"ok","timestamp":1742987286695,"user_tz":0,"elapsed":232,"user":{"displayName":"Annie Qurat ul ain","userId":"16820876301816973135"}},"colab":{"base_uri":"https://localhost:8080/"},"outputId":"58e6a4db-a158-46ee-fc06-631eb25f3cfe"},"execution_count":null,"outputs":[{"output_type":"stream","name":"stdout","text":["Didier Drogba, a name that resonates with football fans worldwide, is an Ivorian legend who transcended the sport to become a symbol of hope and unity for his nation. His powerful presence on the pitch, his clinical finishing, and his ability to rise to the occasion made him one of the most feared strikers of his generation.  Drogba's impact extended beyond club football.  He captained the Ivory Coast national team, leading them to multiple World Cup appearances and becoming their all-time leading scorer.  His influence helped bring a period of peace to his war-torn country, demonstrating the unifying power of sport.  More than just a footballer, Drogba is a humanitarian and a national icon, revered for his contributions both on and off the field.\n","-------------------\n","Samuel Eto'o, a Cameroonian footballing icon, is widely regarded as one of Africa's greatest players. His blistering pace, incredible skill, and prolific goalscoring record earned him accolades at the highest levels of the game.  Eto'o achieved success with top European clubs, winning multiple Champions League titles and league championships. He also led the Cameroon national team to two Africa Cup of Nations victories and an Olympic gold medal.  His electrifying performances on the pitch and his dedication to his craft inspired a generation of African footballers, establishing him as a true legend of the sport.\n","-------------------\n","Haile Gebrselassie, an Ethiopian long-distance running legend, is considered one of the greatest runners of all time.  His remarkable endurance, blistering pace, and unwavering determination earned him two Olympic gold medals and multiple world championships. Gebrselassie's dominance in the marathon and other long-distance events redefined the sport, inspiring athletes and captivating audiences worldwide.  His achievements transcended athletics, making him a national hero in Ethiopia and a global icon of human potential.\n","-------------------\n","Caster Semenya, a South African middle-distance runner, is a symbol of strength, resilience, and the fight for equality in sport.  A two-time Olympic champion and three-time world champion, she has faced numerous challenges and controversies throughout her career.  Semenya's determination to compete at the highest level, despite facing scrutiny and discrimination, has made her an inspiration to athletes and activists worldwide.  She continues to advocate for inclusivity and fairness in sport, challenging traditional notions of gender and athleticism.\n","-------------------\n","Eliud Kipchoge, a Kenyan marathoner, has redefined the limits of human endurance. He holds the world record for the marathon and is the first person to run a marathon in under two hours, achieving this feat in a special event that showcased the pinnacle of human athletic performance.  Kipchoge's dedication to his craft, his unwavering focus, and his positive attitude have made him an inspiration to runners and sports enthusiasts worldwide. He embodies the spirit of pushing boundaries and achieving the seemingly impossible, cementing his place as a legend in the history of marathon running.\n","-------------------\n","Mohamed Salah, an Egyptian football superstar, has captivated fans around the globe with his electrifying skills and prolific goalscoring ability. Playing for Liverpool in the English Premier League, he has achieved remarkable success, winning numerous individual awards and leading his team to domestic and international glory.  Salah's impact extends beyond the pitch. He is a role model for millions in Egypt and across the Arab world, embodying dedication, talent, and humility.  His achievements have elevated him to iconic status, making him a symbol of national pride and a source of inspiration for aspiring footballers.\n","-------------------\n","Francine Niyonsaba, a Burundian middle-distance runner, is a testament to resilience and the pursuit of excellence in the face of adversity.  A world-class athlete specializing in the 800 meters, she has consistently performed at the highest level, earning medals at international championships, including a silver medal at the Olympic Games.  Niyonsaba's career has not been without its challenges; she has faced scrutiny and regulations regarding her natural testosterone levels. However, she has remained steadfast in her commitment to the sport, continuing to train and compete with unwavering determination. Niyonsaba's story is one of courage, perseverance, and the unwavering pursuit of dreams, making her an inspiration to athletes and individuals facing obstacles worldwide.\n","-------------------\n","Peres Jepchirchir, a Kenyan long-distance runner, has etched her name in the annals of marathon history.  She is an Olympic champion, a two-time World Athletics Half Marathon Championships gold medalist, and the current world record holder in the women's-only half marathon. Jepchirchir's accomplishments reflect her exceptional talent, dedication, and unwavering focus. She consistently pushes the boundaries of human endurance, demonstrating remarkable speed and stamina. Jepchirchir's victories are not just personal triumphs; they represent the strength and resilience of Kenyan women in athletics, inspiring future generations of runners to pursue their own dreams of greatness.\n","-------------------\n","Asisat Oshoala, a Nigerian football sensation, has taken the world by storm with her dazzling skills and prolific goalscoring record.  She plays for FC Barcelona Femení and captains the Nigerian national team. Oshoala has garnered numerous accolades, including being named African Women's Footballer of the Year five times, a record in the award's history. Her performances on the pitch are characterized by speed, agility, and a keen eye for goal. Beyond her individual achievements, Oshoala is a vocal advocate for women's football in Africa, working to empower young girls and promote the sport. She is a role model for aspiring athletes, demonstrating the power of talent, hard work, and determination to achieve success on the global stage.\n","-------------------\n","Ajara Nchout Njoya, a Cameroonian footballer, has made significant contributions to both club and country.  She plays as a forward for Inter Milan in the Italian Serie A and represents Cameroon at the international level. Njoya is known for her versatility, speed, and technical ability on the pitch.  She has played a crucial role in Cameroon's success, helping them qualify for the FIFA Women's World Cup and reach the knockout stages.  Njoya's passion for football and her dedication to her team make her a valuable asset and a role model for young players in Cameroon and beyond. Her achievements demonstrate the growing prominence of women's football in Africa and the talent emerging from the continent.\n","-------------------\n","Luvo Manyonga, a South African long jumper, is a story of redemption and triumph over adversity. He overcame personal struggles with drug addiction to achieve remarkable success in athletics. Manyonga won a silver medal at the Olympic Games and a gold medal at the World Championships. His long jump prowess is characterized by incredible power, technique, and an unwavering focus. Manyonga's journey serves as an inspiration, demonstrating the power of the human spirit to overcome challenges and achieve greatness.  He is a symbol of hope and a reminder that second chances are possible, making him a role model for athletes and individuals facing their own personal battles.\n","-------------------\n","Wayde van Niekerk, a South African sprinter, is a world-renowned athlete who holds the world record in the 400 meters. He achieved this incredible feat at the Olympic Games, stunning the world with his speed and breaking a record that had stood for almost two decades. Van Niekerk's accomplishment solidified his place among the greatest sprinters of all time.  His dedication to training and his unwavering commitment to excellence have made him a national hero in South Africa and an inspiration to aspiring athletes worldwide.  Van Niekerk's story is a testament to the power of hard work, perseverance, and the pursuit of dreams.\n","-------------------\n","Tulio de Oliveira, a prominent bioinformatician from South Africa, has played a crucial role in the global fight against infectious diseases.  His expertise lies in genomics and epidemiology, using cutting-edge technology to track and understand the evolution of viruses. De Oliveira's work gained international recognition during the COVID-19 pandemic, as he and his team were instrumental in identifying and characterizing several variants of the virus, including the Beta and Omicron variants. His rapid and accurate analysis provided crucial information for public health responses worldwide. De Oliveira's contributions have been invaluable in understanding the spread and evolution of viruses, highlighting the importance of genomic surveillance in pandemic preparedness and response.\n","-------------------\n","Cheikh Anta Diop, a Senegalese scholar and polymath, was a towering figure in African intellectual history. His groundbreaking work challenged conventional narratives about Africa's past, asserting the continent's significant contributions to human civilization. Diop's multidisciplinary approach, combining history, anthropology, linguistics, and physics, led him to propose theories about the origins of humanity and the ancient Egyptian civilization, suggesting an African origin. His work sparked debate and inspired a generation of African scholars to reclaim their history and heritage. Diop's legacy continues to influence discussions about race, culture, and the contributions of Africa to global knowledge.\n","-------------------\n","Philip Emeagwali, a Nigerian-born computer scientist, is known for his pioneering work in high-performance computing. His research focused on utilizing parallel computing techniques to solve complex scientific problems. Emeagwali's innovative approach involved connecting thousands of microprocessors to perform calculations simultaneously, achieving unprecedented computational power. His work earned him the Gordon Bell Prize, a prestigious award in the field of computer science. Emeagwali's achievements have had a significant impact on diverse fields, including weather forecasting, oil reservoir modeling, and computational fluid dynamics. He stands as an inspiration to aspiring scientists, demonstrating the potential of innovative thinking and technological advancement.\n","-------------------\n","Wangari Maathai, a Kenyan environmental and political activist, was a pioneering figure in the global environmental movement. She founded the Green Belt Movement, an organization focused on empowering women, promoting environmental conservation, and advocating for sustainable development. Maathai's work, rooted in the belief that environmental protection is intrinsically linked to social justice and human rights, gained international recognition. She was awarded the Nobel Peace Prize in 2004, becoming the first African woman to receive the honor. Maathai's legacy continues to inspire individuals and organizations worldwide to protect the environment and empower communities to create a more sustainable future.\n","-------------------\n","Tebello Nyokong, a South African chemist, is a leading figure in the field of photodynamic therapy. Her research focuses on developing new photosensitizers, compounds that can be activated by light to destroy cancer cells. Nyokong's work has the potential to revolutionize cancer treatment, offering a less invasive and more targeted approach.  She has received numerous awards for her contributions to science, including the L'Oréal-UNESCO For Women in Science Award. Nyokong's dedication to research and her commitment to improving healthcare in Africa make her a role model for aspiring scientists and a symbol of scientific excellence on the continent.\n","-------------------\n","Segenet Kelemu, an Ethiopian plant pathologist, has dedicated her career to improving food security in Africa.  Her research focuses on developing disease-resistant crops, particularly legumes and grasses, which are crucial for the livelihoods of smallholder farmers. Kelemu's work has had a significant impact on agricultural productivity in Africa, helping to combat crop diseases and improve food security for millions.  She has received international recognition for her contributions, including the L'Oréal-UNESCO For Women in Science Award. Kelemu's passion for science and her commitment to addressing real-world challenges make her an inspiring figure in African science.\n","-------------------\n","El Anatsui, a Ghanaian sculptor, is renowned for his monumental and captivating installations made from recycled materials. He transforms discarded bottle caps, metal scraps, and other found objects into shimmering, tapestry-like works that explore themes of history, consumption, and the environment. Anatsui's innovative approach to sculpture challenges traditional notions of art and materiality. His works, often monumental in scale, evoke a sense of awe and wonder, inviting viewers to contemplate the beauty and complexity of the discarded.  Anatsui's art has been exhibited in major museums and galleries worldwide, establishing him as one of the most important contemporary artists from Africa.\n","-------------------\n","Esther Mahlangu, a South African Ndebele artist, is a celebrated figure who has brought the vibrant geometric patterns of her culture to a global audience.  She is known for her bold and colorful paintings, which adorn traditional Ndebele homes and have also been featured on cars, airplanes, and fashion designs. Mahlangu's work is a powerful expression of Ndebele cultural identity and a testament to the enduring power of indigenous art forms. She has traveled extensively, sharing her art and her culture with the world, becoming a global ambassador for Ndebele art and a symbol of cultural preservation.\n","-------------------\n","Wangechi Mutu, a Kenyan-born, Brooklyn-based artist, creates captivating and provocative mixed media works that explore themes of gender, identity, colonialism, and the African diaspora.  Her collages, paintings, and sculptures often feature fragmented female figures, blending organic and mechanical elements to create surreal and evocative imagery. Mutu's art challenges conventional notions of beauty and power, prompting viewers to confront complex social and political issues.  Her work has been exhibited internationally, establishing her as a leading voice in contemporary art and a powerful commentator on the African experience in a globalized world.\n","-------------------\n","Ibrahim El-Salahi, a Sudanese painter, is a pioneering figure in African modernism. He draws inspiration from Islamic calligraphy, Arabic script, and African visual traditions to create distinctive and evocative abstract works. El-Salahi's art reflects his deep engagement with Sudanese culture and his exploration of spirituality and identity.  His paintings, characterized by flowing lines, intricate patterns, and subtle color palettes, invite contemplation and evoke a sense of mystical beauty. El-Salahi's work has been exhibited internationally, establishing him as a major figure in modern African art and a significant contributor to the development of abstract painting.\n","-------------------\n","Julie Mehretu, an Ethiopian-born American artist, creates large-scale abstract paintings that explore themes of urbanization, globalization, and social change.  Her work is characterized by layers of intricate lines, gestural marks, and architectural forms, creating dynamic and complex compositions. Mehretu's paintings evoke a sense of movement and energy, reflecting the rapid pace of contemporary life and the ever-changing urban landscape.  Her art has been exhibited in major museums worldwide, establishing her as a prominent figure in contemporary abstract painting and a significant voice in the global art scene.\n","-------------------\n","William Kentridge, a South African artist, is known for his distinctive and powerful multimedia work that addresses themes of history, politics, and memory.  He often uses charcoal drawings, animation, film, and theater to create evocative narratives that explore the complexities of South Africa's past and its ongoing social and political challenges. Kentridge's art is characterized by a sense of fragmentation, movement, and transformation, reflecting the fractured nature of memory and the ongoing process of historical reckoning.  His work has been exhibited and performed internationally, establishing him as a major figure in contemporary art and a powerful voice on issues of social justice and historical memory.\n","-------------------\n","The Lagos air was thick with humidity, but the energy in the club was electric. The band launched into a hypnotic Afrobeat groove, the drums pounding out a complex polyrhythm, the horns blaring a soaring melody, and the bass laying down a deep, funky foundation.  A young woman named Imani moved effortlessly to the music, her body swaying in time with the rhythm. The music seemed to flow through her, a powerful current of energy and joy.  All around her, people were dancing, singing, and clapping, caught up in the infectious rhythm.  The music was more than just entertainment; it was a celebration of life, a connection to their shared heritage, a vibrant expression of the soul of Lagos.\n","-------------------\n","The warm evening air in Accra was filled with the lilting melodies of Highlife music.  At a small bar tucked away on a side street, a band played, the guitars weaving intricate patterns, the horns adding a bright, joyful counterpoint.  Kwame, a young man with a wistful smile, sat at a table nursing a beer, lost in the music.  The Highlife tunes evoked memories of his childhood, of family gatherings, of dancing under the stars. The music was a soundtrack to his life, a reminder of his roots, a source of comfort and joy in the bustling city.\n","-------------------\n","The bustling streets of Lagos were alive with the sounds of Juju music. From a small radio in a market stall, the distinctive rhythms and vocals of King Sunny Adé poured out, drawing a crowd of listeners.  Mama Bisi, a woman with a warm smile and a contagious laugh, tapped her feet to the beat as she haggled for vegetables. The music was a constant companion in her life, a source of energy and inspiration, a reminder of the rich cultural tapestry of Nigeria.\n","-------------------\n","The Dakar waterfront was buzzing with activity as the sun began to set.  From a nearby restaurant, the vibrant sounds of Mbalax music spilled out, the distinctive vocals of Youssou N'Dour soaring over the complex percussion and the hypnotic basslines. A group of friends, gathered for an evening meal, swayed to the music, their faces lit up with smiles.  The Mbalax rhythms, a blend of traditional Senegalese music and modern influences, created an atmosphere of celebration and joy, a vibrant expression of Senegalese culture.\n","-------------------\n","The Kinshasa night was alive with the infectious energy of Soukous music.  In a crowded nightclub, the band played, the guitars weaving intricate melodies, the drums driving the rhythm, and the singers' voices urging everyone to dance.  Jean-Pierre, a young man with boundless energy, moved his feet to the beat, lost in the music. The Soukous rhythms, a fusion of Congolese rumba and other influences, created a whirlwind of movement and joy, a celebration of life and music in the heart of Africa.\n","-------------------\n","In a small township outside Durban, a group of men gathered in a community hall. They were members of an Isicathamiya choir, practicing their intricate harmonies and synchronized dance moves.  The music, characterized by its a cappella vocals and close harmonies, filled the hall with a powerful and moving sound.  For these men, Isicathamiya was more than just music; it was a way to express their emotions, to connect with their Zulu heritage, and to find solace and strength in the face of adversity.\n","-------------------\n","The vibrant colors and intricate patterns of Kente cloth, a symbol of Ghanaian royalty and prestige, tell stories of history, culture, and social status. Woven on narrow looms by skilled artisans, each strip of Kente is a testament to patience and artistry. The geometric designs, rich with symbolism, represent proverbs, historical events, and important figures.  Worn during special occasions and ceremonies, Kente cloth embodies the spirit of Ghana, its vibrant culture, and its rich history.  From the bright yellows and golds representing royalty to the deep blues and greens symbolizing spirituality, Kente is a visual language, a wearable expression of Ghanaian identity and heritage.\n","-------------------\n","Bogolanfini, or mud cloth, from Mali, is a textile steeped in tradition and symbolism.  Its distinctive patterns, created using fermented mud and natural dyes, tell stories of Malian culture, history, and beliefs.  The process of creating Bogolanfini is as rich and complex as the designs themselves, involving multiple stages of dyeing, painting, and sun-drying.  Each piece is unique, reflecting the artistry and skill of the maker.  Traditionally worn by hunters and warriors, Bogolanfini has become a symbol of Malian identity and a testament to the enduring power of indigenous art forms.\n","-------------------\n","Adire, a resist-dyed indigo cloth from Nigeria, is a vibrant expression of Yoruba culture and creativity.  The intricate patterns, created using various techniques such as stitching, tying, and applying starch paste, represent proverbs, stories, and symbols of Yoruba cosmology.  Adire, meaning “tied and dyed,” is a testament to the ingenuity and artistry of Yoruba women, who have passed down these techniques through generations.  From the bold, geometric designs of Adire Eleko to the more fluid patterns of Adire Oniko, Adire cloth is a celebration of Yoruba artistry and a symbol of cultural pride.\n","-------------------\n","Kanga, a colorful printed cloth from East Africa, particularly Tanzania and Kenya, is more than just a fabric; it's a form of communication and social expression.  Each Kanga features a central design surrounded by a border and a proverb or saying, often written in Swahili.  These proverbs offer advice, commentary on social issues, or expressions of love and friendship.  Kanga are worn by women for everyday wear, special occasions, and as gifts, serving as a vibrant symbol of East African culture and a testament to the power of language and visual expression.\n","-------------------\n","Ankara, also known as African wax print fabric, is a vibrant and versatile textile popular across Africa and beyond.  Its bold, colorful patterns, often featuring geometric designs, floral motifs, and intricate details, are produced through a complex process of wax-resist dyeing.  While not originally from Africa, Ankara has become a symbol of African fashion and cultural expression, adapted and embraced by diverse communities.  Its versatility allows for a wide range of styles and garments, reflecting individual creativity and cultural identity.  Ankara is a testament to the power of cross-cultural exchange and the dynamic evolution of African fashion.\n","-------------------\n","Shweshwe, a printed cotton fabric characterized by intricate geometric patterns, is a beloved textile in Southern Africa, particularly in Lesotho and South Africa.  Originally introduced by German settlers in the 19th century, it has become deeply ingrained in local cultures, evolving into a unique and distinctive fabric.  Shweshwe's vibrant indigo, brown, and red hues, along with its intricate geometric designs, have made it a popular choice for traditional garments, contemporary fashion, and home décor. The fabric's enduring popularity is a testament to its beauty, versatility, and its ability to represent cultural heritage and identity.\n","-------------------\n","The Sahara Desert is characterized by an extremely arid climate, with scorching hot days and surprisingly cold nights. Rainfall is scarce and unpredictable, with some areas receiving less than 25 millimeters (1 inch) annually. Temperatures can soar above 50°C (122°F) during the day, while at night, the lack of cloud cover allows heat to escape rapidly, causing temperatures to plummet, sometimes even below freezing. Strong winds, known as the Harmattan, often carry dust and sand across vast distances, shaping the landscape and impacting visibility.\n","-------------------\n","The Congo Basin experiences a tropical rainforest climate, characterized by high humidity, abundant rainfall, and consistently warm temperatures. Rainfall is heavy throughout the year, exceeding 2,000 millimeters (79 inches) annually, contributing to the dense vegetation of the rainforest. Temperatures remain relatively constant, typically ranging from 24°C to 27°C (75°F to 81°F) throughout the year. The high humidity and lack of seasonal variation create a stable, warm, and wet environment that supports incredible biodiversity.\n","-------------------\n","The Sahel region, a semi-arid transitional zone between the Sahara Desert and the savannas to the south, is characterized by a hot, dry climate with a distinct wet and dry season.  The wet season, typically lasting a few months, brings much-needed rainfall, though the amount can vary significantly from year to year.  The dry season is long and hot, with temperatures often exceeding 40°C (104°F).  The Sahel is prone to droughts, which can have devastating impacts on agriculture and livelihoods, highlighting the challenges of living in this harsh and unpredictable environment.\n","-------------------\n","The East African Highlands enjoy a temperate climate, moderated by their high altitude. Despite being located near the equator, temperatures are generally cooler than in the surrounding lowlands, particularly at night.  Rainfall patterns vary depending on location and elevation, with some areas experiencing two wet seasons.  The highlands are known for their fertile soils and agricultural productivity, benefiting from the combination of moderate temperatures and adequate rainfall.  This climate has also contributed to the region's rich biodiversity, supporting a variety of plant and animal species.\n","-------------------\n","The Mediterranean coast of North Africa enjoys a Mediterranean climate, characterized by hot, dry summers and mild, wet winters.  Rainfall is concentrated in the winter months, while summers are typically dry and sunny.  Temperatures are moderate, with warm summers and cool, but rarely freezing, winters.  This climate supports a unique ecosystem, with vegetation adapted to the dry summer conditions.  The Mediterranean coast is also known for its agricultural production, particularly of fruits, vegetables, and olives, which thrive in this climate.\n","-------------------\n","Southern Africa experiences a diverse range of climates, from arid deserts in the west to subtropical regions in the east.  The western coast is characterized by the Namib Desert, one of the driest places on Earth.  The interior regions have a more temperate climate, with warm summers and cool winters. The eastern coast is influenced by the warm Agulhas Current, resulting in a subtropical climate with warm temperatures and higher rainfall.  Southern Africa is also prone to seasonal variations, with distinct wet and dry seasons in many areas.\n","-------------------\n","Madagascar, an island nation off the southeast coast of Africa, has a varied climate due to its diverse topography and exposure to different weather patterns.  The eastern coast is characterized by a tropical rainforest climate, with high humidity and abundant rainfall.  The central highlands have a more temperate climate, with cooler temperatures and distinct wet and dry seasons.  The western coast is drier, with a semi-arid climate in some areas. The southern part of the island is the driest, with a desert climate in some regions.  This climatic diversity contributes to Madagascar's unique biodiversity, making it a hotspot for endemic plant and animal species.\n","-------------------\n","Abeni, a bright-eyed girl with braids adorned with colorful beads, lived in a small village nestled beside a sparkling river. The air often hummed with the rhythmic pounding of mortars and pestles as women prepared the evening meal. But no aroma was as enticing to Abeni as the rich, smoky fragrance of Jollof Rice, her absolute favorite. When her mother, Mama Ada, began to prepare it, Abeni would abandon her games with the other children and perch herself on a stool by the cooking fire, her eyes wide with anticipation. Mama Ada would start by sautéing finely chopped onions in palm oil until they turned a golden brown, their sweet smell filling the air. Then, she’d add crushed tomatoes, fiery scotch bonnet peppers, and a secret blend of spices passed down through generations of women in their family.  The vibrant red sauce would simmer and bubble, its aroma becoming richer and more complex with each passing moment. Finally, she would add long-grain rice, stirring it gently into the sauce until each grain was coated in the fiery red hue. As the Jollof Rice cooked, Abeni would listen intently to Mama Ada's stories, tales of brave ancestors, mischievous spirits, and wise proverbs. The stories, like the spices in the Jollof Rice, added layers of flavor and richness to Abeni's understanding of her heritage. When the rice was finally cooked, each grain plump and glistening, Mama Ada would serve it on large platters, garnished with fried plantains and succulent pieces of grilled chicken. The family would gather around, their faces illuminated by the warm glow of the fire and the vibrant red of the Jollof Rice. Each mouthful was a burst of flavor – smoky, spicy, savory, and slightly sweet. To Abeni, Jollof Rice was more than just food; it was a symbol of home, family, and the rich tapestry of her culture.\n","-------------------\n","Alem, a small boy with a mischievous grin, lived in a village high in the Ethiopian highlands, where the air was thin and the views stretched forever. He loved helping his mother, Mama Selamawit, in their traditional roundhouse kitchen. But his favorite task was watching her make Injera, the spongy, slightly sour flatbread that formed the base of every Ethiopian meal. Mama Selamawit would begin by mixing teff flour – a tiny grain unique to Ethiopia – with water.  She'd then let the batter ferment for several days, a process that gave Injera its distinctive tangy flavor. When it was ready, she would skillfully pour the batter onto a large, circular griddle called a 'mitad,' creating a large, thin pancake.  As the Injera cooked, small bubbles would form on its surface, creating a unique, porous texture. The air would fill with a slightly sour, yeasty aroma that Alem found comforting and familiar. Once the Injera was cooked, Mama Selamawit would carefully peel it off the mitad and stack it on a platter, ready to be served.  Alem loved to tear off pieces of the warm Injera and use it to scoop up the colorful array of stews and vegetables that Mama Selamawit had prepared – spicy 'doro wat' (chicken stew), flavorful 'misir wat' (lentil stew), and vibrant 'gomen' (collard greens).  Each bite was a symphony of flavors and textures, the soft, slightly sour Injera complementing the rich, savory dishes. Alem believed that Injera was more than just food; it was a symbol of his heritage, a connection to the land and the generations of Ethiopians who had enjoyed this unique bread before him.\n","-------------------\n","Fatima, a young girl with sparkling eyes and a vibrant headscarf, loved exploring the bustling souks of Marrakech with her father, Baba Ali.  The air was always filled with a kaleidoscope of scents – fragrant spices, sweet pastries, and the earthy aroma of cooking tagines.  Tagine, a slow-cooked stew named after the conical earthenware pot in which it is prepared, was Fatima's favorite food.  Baba Ali, a skilled cook, would often prepare tagine for their family, using recipes passed down through generations. He would start by arranging pieces of tender lamb or chicken in the base of the tagine, layering them with onions, garlic, and a medley of fragrant spices – cumin, coriander, turmeric, ginger, and saffron.  Then, he would add dried fruits like apricots or prunes, along with vegetables such as carrots, potatoes, and zucchini. Finally, he'd pour in a little water or broth and place the conical lid on top, sealing in all the delicious aromas. The tagine would simmer slowly over hot coals or in a low oven, the fragrant steam escaping from under the lid, hinting at the culinary magic happening inside. As the tagine cooked, Fatima would sit beside her father, listening to his stories of desert caravans, ancient cities, and the magic of Moroccan hospitality. When the tagine was ready, Baba Ali would carefully remove the lid, releasing a cloud of fragrant steam. The meat would be meltingly tender, the vegetables infused with the rich spices, and the dried fruits plump and juicy. They would eat the tagine communally, dipping pieces of crusty bread into the flavorful sauce. For Fatima, tagine was more than just a meal; it was a symbol of warmth, family, and the rich cultural heritage of Morocco.\n","-------------------\n","The South African sun beat down warmly on Thabo's face as he bounced in the back of his grandfather's bakkie, the dusty road rumbling beneath them. They were headed to their favorite picnic spot, a grassy clearing overlooking a valley dotted with acacia trees. Today was a special day – Grandpa was making Pap en Vleis, a South African braai classic. As they arrived, Grandpa, a man with weathered hands and a warm smile, set about building a fire with seasoned wood, the smoke curling lazily into the clear blue sky. Thabo helped gather smooth stones to create a makeshift braai, his excitement bubbling like the pot of water Grandpa set to boil for the 'pap' (maize meal). While the fire crackled merrily, Grandpa marinated thick cuts of boerewors (South African sausage) and juicy lamb chops in a secret blend of spices – coriander, cumin, garlic, and a hint of chili. Thabo watched, mesmerized, as Grandpa expertly grilled the meat over the open flames, the sizzling sound and smoky aroma making his mouth water. Meanwhile, he stirred the creamy white pap, ensuring it was smooth and lump-free, a task he took with utmost seriousness.  As the sun dipped towards the horizon, casting long shadows across the valley, the Pap en Vleis was ready. The meat, charred on the outside and juicy within, was piled high on a platter, its savory juices mingling with the smoky aroma of the braai. Thabo eagerly spooned a mound of steaming pap onto his plate, shaping it into a small well to hold the delicious gravy from the meat. Each mouthful was a burst of South African sunshine – the creamy pap, the flavorful meat, and the smoky char of the braai.  For Thabo, Pap en Vleis was more than just a meal; it was a taste of home, a symbol of family, and the simple joys of life under the African sky.\n","-------------------\n","Esi, a young girl with a bright smile and nimble fingers, loved spending time with her grandmother, Nana Yaa, in their cozy kitchen in a Ghanaian village. Nana Yaa, a woman with boundless energy and a wealth of culinary knowledge, was teaching Esi the art of making Fufu, a staple food in their community. The process began with peeling and chopping plantains and cassava, their starchy flesh gleaming in the afternoon sun. Then came the rhythmic pounding, a task that required strength and precision. Esi and Nana Yaa took turns, their wooden pestles rising and falling in a harmonious dance, crushing the plantains and cassava into a smooth, sticky paste. The air filled with the thud of pestles against mortars, a sound that echoed throughout the village, a familiar rhythm of daily life. As they pounded, Nana Yaa shared stories with Esi – folktales of cunning tricksters, wise proverbs, and the history of their ancestors. The stories, like the Fufu, were a source of nourishment, connecting Esi to her heritage.  When the pounding was complete, the paste was kneaded and shaped into smooth, round balls, their surfaces glistening with a subtle sheen. The Fufu was then served with a variety of flavorful soups and stews – light and tomato-based, rich and peanut-infused, or spicy with palm nut oil and chili peppers. Esi loved to tear off a piece of Fufu, dip it into the flavorful soup, and savor the combination of textures and tastes – the soft, slightly elastic Fufu absorbing the rich flavors of the stew.  For Esi, Fufu was more than just food; it was a symbol of community, a dish that brought people together, a taste of home, and the love that went into its preparation.\n","-------------------\n","Sofia, a girl with a mischievous glint in her eyes and a love for all things spicy, lived in a small coastal town in Mozambique.  The salty air, the warm sunshine, and the vibrant colors of the local market were part of her everyday life. But nothing excited Sofia more than the aroma of Piri-Piri Chicken grilling over charcoal, a scent that promised a fiery feast. Her father, Papa Joaquim, was the master of Piri-Piri, a small, potent chili pepper that gave the chicken its unique flavor. He would carefully grind the fiery peppers with garlic, lemon juice, and a secret blend of spices, creating a vibrant red marinade that was both tangy and intensely hot. The chicken, marinated for hours, would then be grilled over hot coals, the flames licking at its skin, creating a crispy, charred exterior while keeping the meat juicy and tender. As the chicken cooked, the air filled with a smoky aroma, laced with the pungent scent of Piri-Piri, a smell that made Sofia's mouth water and her stomach rumble with anticipation.  When the chicken was finally ready, Papa Joaquim would serve it on a large platter, garnished with fresh cilantro and lime wedges.  Sofia would eagerly tear off a piece of the chicken, the crispy skin crackling under her teeth, followed by a burst of intense heat and flavor. The Piri-Piri sauce, clinging to the chicken, ignited a delightful fire on her tongue, a sensation she relished. For Sofia, Piri-Piri Chicken was more than just food; it was a symbol of her Mozambican heritage, a taste of the sun-drenched coast, and the warmth of family gatherings.\n","-------------------\n","Mamadou, a young boy with a boundless curiosity and a love for the sea, lived in a bustling fishing village on the coast of Senegal.  The rhythmic sound of waves crashing against the shore, the salty breeze, and the cries of seagulls were the soundtrack of his life. One of Mamadou's favorite things was helping his mother, Yaye Awa, prepare Thieb Toubab, a dish that embodied the spirit of Senegal – a vibrant blend of land and sea.  Yaye Awa, a woman with a gentle smile and skillful hands, would begin by marinating a large, freshly caught fish in a mixture of herbs, spices, and lemon juice. The marinade, a closely guarded family secret, was a symphony of flavors – pungent garlic, fragrant parsley, earthy cumin, and a hint of fiery chili. While the fish marinated, she would prepare a bed of fluffy rice, cooking it in a rich tomato sauce infused with onions, carrots, and other vegetables. The air would fill with the savory aroma of simmering sauce and the tantalizing smell of grilling fish.  Once the rice was cooked, Yaye Awa would carefully place the marinated fish on top, adding stuffed vegetables and hard-boiled eggs around it, creating a colorful and inviting presentation.  The Thieb Toubab, steaming and fragrant, was then placed in the center of the table, a centerpiece of family meals. Mamadou would eagerly dig in, savoring the tender, flavorful fish, the fluffy rice soaked in the rich sauce, and the burst of freshness from the vegetables. For Mamadou, Thieb Toubab was more than just food; it was a taste of his home, a symbol of Senegalese hospitality, and a reminder of the bounty of both land and sea.\n","-------------------\n","The Addis Ababa air buzzed with the energy of a Friday night. Inside a small, brightly lit restaurant tucked away on a bustling street, Hanna, a young university student, eagerly awaited her friends. They met here every week, a ritual of friendship and shared meals. Tonight, Hanna had ordered Doro Wat, a rich and spicy chicken stew, a comforting reminder of home. As her friends arrived, the restaurant filled with laughter and the clinking of silverware. The aroma of berbere spice, onions, and simmering chicken filled the air, a tantalizing invitation to indulge.  Hanna and her friends, a mix of students and young professionals, shared stories of their week, their dreams, and their anxieties. The Doro Wat, served with injera, a spongy flatbread, was the centerpiece of their gathering, a symbol of their shared Ethiopian heritage and their bond as friends in this vibrant city.\n","-------------------\n","The Durban sun beat down on the city streets, casting long shadows as Sipho, a delivery driver, navigated the afternoon traffic. He was on his lunch break, his stomach rumbling with anticipation. He pulled over to a roadside stall, the aroma of curry and freshly baked bread wafting through the air. He ordered a Bunny Chow, a Durban specialty – a hollowed-out loaf of white bread filled with a generous portion of spicy Durban curry.  As he sat on the curb, savoring each mouthful, Sipho watched the city life unfold around him – the hurried footsteps of office workers, the vibrant chatter of market vendors, and the rhythmic beat of street music. The Bunny Chow, a messy but delicious meal, was a perfect reflection of Durban itself – a vibrant, multicultural city with a flavor all its own.\n","-------------------\n","The Abidjan skyline shimmered in the evening light as Ami, a fashion designer, hurried home from her studio. She was exhausted but excited, having just finished a major project.  She stopped by a street food vendor, the smell of grilled fish and fried plantains drawing her in. She ordered Attieke, a side dish made from fermented cassava, a staple in Ivorian cuisine. The Attieke, fluffy and slightly tangy, was served with grilled fish and a spicy tomato sauce. As she ate, sitting at a small plastic table, Ami felt the stress of the day melt away. The familiar taste of Attieke, a taste of home, was a comforting reminder of her roots amidst the hustle and bustle of city life.\n","-------------------\n","The Bamako night was alive with music and laughter. Inside a small restaurant, Moussa, a musician, sat with his bandmates after a rehearsal. They were hungry, their energy depleted after hours of playing. They ordered To, a traditional Malian couscous dish made with steamed millet or sorghum and a rich, savory sauce. As they ate, sharing stories and jokes, the To nourished not just their bodies but also their souls.  The hearty meal, a staple in Malian cuisine, was a symbol of community and connection, a reminder of their shared passion for music and their bond as friends in this vibrant city.\n","-------------------\n","In the heart of Nairobi, the aroma of sizzling meat filled the air as evening descended.  At a bustling open-air restaurant, a group of friends gathered around a table laden with Nyama Choma, grilled meat, a Kenyan staple. The succulent goat meat, charred on the outside and juicy within, was a feast for the senses. As they ate, using their hands to tear off pieces of meat, they shared stories and laughter, the Nyama Choma fueling their conversations and strengthening their bonds.  More than just a meal, Nyama Choma represented a celebration of Kenyan culture, a tradition passed down through generations, a symbol of community and shared enjoyment, providing nourishment and energy for the busy city life.\n","-------------------\n","The Accra streets buzzed with activity as the sun began to set.  At a corner food stall, a young woman named Akosua expertly fried Kelewele, ripe plantains seasoned with ginger, peppers, and spices.  The sweet and spicy aroma wafted through the air, attracting passersby.  People from all walks of life – students, traders, office workers – stopped to buy a portion of the crispy, flavorful Kelewele. It was a quick, affordable, and satisfying snack that provided a burst of energy and a taste of Ghanaian culture.  Each bite was a reminder of the country's rich culinary heritage, a testament to how simple ingredients, skillfully prepared, could nourish and delight.\n","-------------------\n","On a chilly evening in Johannesburg, a family gathered around a crackling fire in their backyard.  The three-legged pot, known as a potjie, simmered over the flames, filled with a hearty stew of meat and vegetables – Potjiekos, a South African culinary tradition.  As the stew slowly cooked, the family shared stories and laughter, the warmth of the fire and the anticipation of the meal bringing them closer. The Potjiekos, a dish born from South Africa's history of outdoor cooking, was more than just food. It was a symbol of resilience, resourcefulness, and the power of shared meals to nourish both body and soul. The slow-cooked flavors, a blend of meat, vegetables, and spices, provided a comforting and satisfying meal that warmed them from the inside out.\n","-------------------\n","In the bustling city of Lagos, the aroma of steamed bean pudding filled the air as the day began. At a small food stall, a woman skillfully scooped portions of Moin Moin, a Nigerian breakfast staple, onto plates. Wrapped in banana leaves and steamed to perfection, the Moin Moin was a nutritious and flavorful way to start the day.  People from all walks of life – students, traders, office workers – stopped by to grab a portion, fueling themselves for the day ahead.  The Moin Moin, a dish rooted in Nigerian culinary tradition, provided essential nutrients and a taste of home, a reminder of cultural heritage amidst the fast-paced urban environment.\n","-------------------\n","Mount Kilimanjaro, a dormant volcano in Tanzania, dominates the East African landscape and holds the title of Africa's highest peak. Reaching a height of 5,895 meters (19,341 feet) above sea level, it attracts thousands of climbers annually, eager to conquer its challenging slopes and witness the breathtaking sunrise from its summit.  Composed of three distinct volcanic cones – Kibo, Mawenzi, and Shira – Kilimanjaro boasts a variety of ecological zones, from lush rainforests at its base to alpine deserts and glacial ice at its peak.  Its unique location near the equator allows climbers to experience diverse climates in a single ascent. While the summit attempt is physically demanding, the reward of reaching Uhuru Peak, the highest point on Kibo, is an unforgettable experience, offering panoramic views of the surrounding plains and a sense of accomplishment that few other climbs can match. Beyond its allure for adventurers, Kilimanjaro holds deep cultural significance for the indigenous Chagga people, who have lived on its slopes for centuries and regard the mountain as a sacred place.\n","-------------------\n","Victoria Falls, one of the world's largest and most spectacular waterfalls, straddles the border between Zambia and Zimbabwe.  Locally known as 'Mosi-oa-Tunya' – 'The Smoke that Thunders' – it earns its name from the deafening roar and immense spray cloud created as the Zambezi River plunges over a basalt cliff into a narrow gorge. The falls are over a mile wide, with a height of more than 100 meters (328 feet), making them roughly twice the height of Niagara Falls. The constant spray nourishes the surrounding rainforest, creating a lush oasis teeming with diverse flora and fauna.  Visitors can experience the falls from various viewpoints, each offering a unique perspective on this natural wonder.  Activities such as white-water rafting, bungee jumping, and helicopter tours provide thrilling ways to appreciate the power and beauty of Victoria Falls, while guided walks and boat trips allow for a closer look at the surrounding wildlife and stunning landscapes.\n","-------------------\n","The Pyramids of Giza, located on the outskirts of modern-day Cairo, are iconic symbols of ancient Egypt and enduring testaments to the power and ingenuity of the pharaohs.  These massive stone structures, built as tombs for the kings of the Fourth Dynasty, are among the oldest and most impressive man-made structures on Earth. The largest of the three main pyramids, the Great Pyramid of Khufu, was the tallest structure in the world for over 3,800 years.  The pyramids were meticulously designed and constructed using massive blocks of stone, reflecting the advanced engineering and mathematical knowledge of the ancient Egyptians. They also offer insights into the complex religious beliefs of the time, as they were believed to be passageways to the afterlife for the pharaohs.  Today, the Pyramids of Giza are a UNESCO World Heritage Site and one of the most visited tourist destinations in the world, drawing millions who come to marvel at their grandeur and contemplate the mysteries of ancient civilizations.\n","-------------------\n","Table Mountain, a flat-topped landmark overlooking Cape Town, South Africa, is a symbol of the city and a natural wonder recognized for its unique geology and biodiversity. Its distinctive plateau, formed by resistant sandstone layers, provides panoramic views of the city, the coastline, and the surrounding ocean.  Accessible by a rotating cable car, the summit offers breathtaking vistas and opportunities for hiking and exploring the diverse fynbos vegetation, a type of shrubland endemic to the Cape Floral Region. Table Mountain National Park, which encompasses the mountain, protects a wide range of plant and animal species, making it a valuable conservation area.  From the top, visitors can see Robben Island, where Nelson Mandela was imprisoned, adding a layer of historical significance to the experience.  Table Mountain's iconic presence and natural beauty make it an essential destination for anyone visiting Cape Town.\n","-------------------\n","The Serengeti National Park, located in Tanzania, is a vast ecosystem teeming with wildlife and renowned for the annual Great Migration, one of the most spectacular natural events on Earth.  Millions of wildebeest, zebras, and other herbivores traverse the plains in search of fresh grazing, followed by predators such as lions, cheetahs, and hyenas.  The park's diverse landscapes, from open grasslands to acacia woodlands and riverine forests, support a vast array of animal species, making it a paradise for wildlife enthusiasts and photographers.  Visitors can embark on game drives, guided walks, and hot air balloon safaris to witness the incredible wildlife spectacles and experience the raw beauty of the Serengeti. The park plays a vital role in conservation efforts, protecting endangered species and preserving the delicate balance of this unique ecosystem.\n","-------------------\n","The Marrakech Medina, the old walled city of Marrakech, Morocco, is a vibrant labyrinth of narrow streets, bustling souks (markets), and historic landmarks.  A UNESCO World Heritage Site, it offers a sensory overload of sights, sounds, and smells, transporting visitors back in time.  The Djemaa el-Fna, the main square, is the heart of the Medina, filled with storytellers, musicians, snake charmers, and food stalls.  The souks are a treasure trove of handcrafted goods, spices, textiles, and leather goods, where bargaining is a customary part of the shopping experience.  Hidden within the Medina's walls are beautiful mosques, palaces, and traditional riads (guesthouses), offering glimpses into the rich history and cultural heritage of Marrakech.  Exploring the Medina is an adventure in itself, a chance to get lost in the maze of alleyways and discover hidden gems around every corner.\n","-------------------\n","The air hung thick with the scent of ripe mangoes, fragrant spices, and smoked fish. Sunlight streamed through the gaps in the corrugated iron roof, illuminating the vibrant colors of the textiles, the glistening scales of the fish, and the smiling faces of the market vendors.  Aunostine, a young woman with a brightly patterned headscarf, expertly navigated the crowded aisles, haggling good-naturedly with the traders.  Children darted through the throng, their laughter echoing amidst the calls of the vendors and the chatter of the shoppers. The market was a symphony of life, a vibrant hub where the community gathered to trade, socialize, and celebrate the abundance of Ghana.\n","-------------------\n","Dust swirled in the air as the children, dressed in crisp uniforms, poured out of the small schoolhouse, their voices a chorus of excitement. The school, a simple structure with mud walls and a thatched roof, stood proudly amidst the rolling hills of the Tanzanian countryside. Inside, Mr. Kimaro, the teacher, patiently guided his students through their lessons, his voice a calming presence in the small classroom.  The children, eager to learn, leaned forward in their desks, their eyes shining with curiosity. The school was a beacon of hope, a place where knowledge was imparted, dreams were nurtured, and the future of Tanzania was being shaped, one lesson at a time.\n","-------------------\n","The hum of activity filled the air – the beeping of machines, the hurried footsteps of nurses, the hushed conversations of doctors.  In the waiting room, patients sat patiently, their faces etched with worry and hope.  Dr. Adebayo, a young doctor with a calm demeanor, moved purposefully through the corridors, attending to his patients with care and compassion. The hospital, a sprawling complex in the heart of Lagos, was a place of intense emotions – a place where lives were saved, battles were fought, and miracles sometimes happened. It was a testament to the resilience of the human spirit and the dedication of those who worked tirelessly to heal and comfort.\n","-------------------\n","The afternoon sun cast long shadows across the dusty road as a group of men gathered at a small cafe, sipping sweet mint tea and sharing stories.  The cafe, a simple structure with a few tables and chairs under a canvas awning, was a haven from the desert heat. The air hummed with the sounds of conversation, the clinking of glasses, and the occasional rumble of a passing truck. The cafe was a place of respite, a place where travelers and locals alike could pause, refresh themselves, and connect with the rhythms of Moroccan life.\n","-------------------\n","The rhythmic beat of Afrobeat music filled the small barbershop, punctuated by the buzz of clippers and the friendly banter between the barbers and their customers.  Posters of football stars adorned the walls, and the air was thick with the scent of aftershave.  Kenneth, the barber, skillfully shaped his client's hair, his hands moving with precision and artistry.  The barbershop was more than just a place to get a haircut; it was a social hub, a place where men exchanged news, debated politics, and shared laughter. It was a microcosm of Nairobi life, a vibrant and energetic space where community bonds were strengthened with each snip of the clippers.\n","-------------------\n","Sunlight streamed through the windows of the small library, illuminating rows of well-worn books.  The air was quiet, filled only with the rustling of pages and the occasional cough of a reader.  Alem, a young boy with a thirst for knowledge, sat absorbed in a book, his brow furrowed in concentration.  The library, a simple mud-brick building in a rural Ethiopian village, was a sanctuary for learning, a place where worlds could be explored, imaginations ignited, and futures shaped. It was a testament to the power of literacy and the enduring human desire for knowledge.\n","-------------------\n","The sun beat down warmly on the golden sands of the Gambian coast.  Fishing boats bobbed gently in the turquoise waters, and the air was filled with the salty tang of the ocean and the rhythmic beat of drums from a nearby village. Children played in the shallows, their laughter carried on the gentle breeze.  Fishermen mended their nets, their weathered faces reflecting years of working under the African sun.  Life in the village moved at a slower pace, dictated by the tides and the rhythm of nature. The warm, tropical climate and the abundance of the sea provided a simple but fulfilling existence for the villagers, who lived in harmony with their surroundings.\n","-------------------\n","The crisp mountain air carried the scent of pine and wildflowers.  Clouds clung to the rugged peaks, casting long shadows over the valleys below.  In a small village nestled high in the mountains of Lesotho, villagers wrapped themselves in thick blankets against the morning chill. Shepherds led their flocks of sheep along winding paths, their voices echoing through the valleys. The rugged terrain and the harsh climate demanded resilience and resourcefulness from the villagers, who lived a life deeply connected to the land and its rhythms.  The breathtaking scenery and the sense of community provided a unique and fulfilling existence in this remote corner of Africa.\n","-------------------\n","The sun blazed down mercilessly on the dusty streets of the Djiboutian town. The air shimmered with heat, and the landscape stretched out in a seemingly endless expanse of sand and rock.  Camels, laden with goods, plodded slowly through the streets, their riders seeking shelter from the midday sun.  Shopkeepers sat in the shade of their stalls, patiently waiting for customers. Life in the desert town was a constant negotiation with the elements, a test of endurance and adaptability.  Despite the harsh conditions, the people of Djibouti had carved out a life in this unforgiving landscape, their resilience a testament to the human spirit.\n","-------------------\n","The calm waters of Lake Malawi sparkled in the afternoon sun.  Fishermen cast their nets from brightly painted wooden boats, their rhythmic movements a timeless dance.  Children played on the sandy shores, their laughter echoing across the water.  The air was filled with the sounds of birdsong and the gentle lapping of waves.  The town, nestled on the shores of the lake, was a haven of tranquility, a place where life moved at a slower pace, and the beauty of nature was ever-present.  The fertile lands surrounding the lake provided sustenance for the villagers, who lived in harmony with the water that gave them life.\n","-------------------\n","The street pulsed with life – the vibrant colors of clothing, the enticing aromas of street food, the rhythmic beat of music spilling from open doorways.  Motorcycles zipped through the crowds, their horns beeping in a chaotic symphony.  Vendors hawked their wares, their voices rising above the din.  The street was a microcosm of Togo, a country bursting with energy and dynamism.  The warm, humid air was alive with the sights, sounds, and smells of West Africa, a sensory experience that was both exhilarating and overwhelming.\n","-------------------\n","The rolling hills of Swaziland (Eswatini) stretched out as far as the eye could see, dotted with traditional homesteads.  Cattle grazed peacefully in the fields, and the air was filled with the chirping of birds and the distant sound of children singing.  In a small village, life moved at a gentle pace, guided by the traditions and customs of the Swazi people.  The warm, subtropical climate and the fertile land provided a peaceful and harmonious existence, where community bonds were strong and the rhythms of rural life were deeply respected.\n","-------------------\n","The Afro-Asiatic language family is one of the largest and most geographically widespread language families in the world. It encompasses languages spoken across North Africa, the Horn of Africa, the Arabian Peninsula, and parts of the Middle East.  Major branches include Semitic (Arabic, Hebrew, Amharic), Berber, Cushitic (Somali, Oromo), Chadic (Hausa), and Egyptian (extinct, but ancestor of Coptic). Afro-Asiatic languages are characterized by a complex system of consonant sounds and often employ non-concatenative morphology, meaning that word formation involves changes to the vowels within a root, rather than adding prefixes or suffixes. The family's vast geographic distribution and deep historical roots reflect its significant influence on the cultural and linguistic landscape of Africa and beyond.\n","-------------------\n","The Niger-Congo language family is the largest language family in Africa in terms of the number of languages and speakers. It covers most of sub-Saharan Africa, including West Africa, Central Africa, Southern Africa, and parts of East Africa.  The family is incredibly diverse, with major branches like Bantu (Swahili, Zulu, Xhosa), Atlantic (Wolof, Fula), Mande (Bambara, Mandinka), and Kwa (Akan, Igbo, Yoruba). Niger-Congo languages are characterized by a system of noun classes, where nouns are grouped into categories that trigger agreement on verbs and other words.  The Bantu languages, in particular, have spread extensively across the continent, demonstrating the historical migrations and interactions of Bantu-speaking peoples.\n","-------------------\n","The Nilo-Saharan language family is spoken in parts of East Africa, Central Africa, and the Sahara Desert. It includes languages such as Maasai, Luo, Dinka, Nuer, Songhay, and Fur.  While the classification of Nilo-Saharan languages is still debated among linguists, it is considered a relatively old language family with a complex internal structure.  Many Nilo-Saharan languages are tonal, meaning that the pitch of a syllable can change the meaning of a word. These languages are often spoken in regions with significant cultural and ecological diversity, reflecting the adaptation of Nilo-Saharan communities to a variety of environments.\n","-------------------\n","The Khoisan languages, spoken primarily in southern Africa, are characterized by their distinctive use of click consonants.  Click sounds are produced by creating a vacuum with the tongue and then releasing it, resulting in a sharp, percussive sound.  The Khoisan languages are relatively small in number compared to other African language families, and they are geographically concentrated in southwestern Africa.  While some Khoisan languages are endangered due to social and economic pressures, they represent a unique and ancient linguistic heritage, providing valuable insights into the history and diversity of human language.\n","-------------------\n","While primarily associated with Southeast Asia and the Pacific, the Austronesian language family also has a presence in Africa through the Malagasy language, spoken in Madagascar.  Malagasy is believed to have arrived in Madagascar around the 5th century AD, brought by seafaring Austronesian peoples from the Malay Archipelago.  This linguistic connection highlights the historical migrations and cultural exchanges that have shaped the African continent, demonstrating the influence of maritime trade and cultural diffusion across vast distances.\n","-------------------\n","The Indo-European language family is primarily associated with Europe and Asia, but it also has a presence in Africa due to colonial history.  Languages such as English, French, Portuguese, Spanish, and Afrikaans are spoken in various parts of Africa, reflecting the legacy of European colonization.  These languages often serve as official languages or languages of education and commerce, alongside indigenous African languages.  The presence of Indo-European languages in Africa highlights the complex linguistic landscape of the continent, shaped by historical interactions and globalization.\n","-------------------\n","Sign languages used in Africa are diverse and often unrelated to sign languages used elsewhere.  Many countries have their own distinct sign languages, reflecting the linguistic and cultural variations across the continent.  While some sign languages may have influences from European or international sign languages, others are indigenous and have developed independently.  Research and documentation of African sign languages are ongoing, contributing to a better understanding of the linguistic diversity and communication systems used by deaf communities across Africa.\n","-------------------\n","Nok sculpture, from ancient Nigeria (c. 1000 BCE – 200 CE), represents some of the earliest known figurative art in sub-Saharan Africa.  These terracotta sculptures, often fragmented, depict human figures and animals with stylized features, including large, almond-shaped eyes and elaborate hairstyles.  Nok sculptures were created using a sophisticated firing process and demonstrate a remarkable understanding of human anatomy and form. They provide valuable insights into the early artistic traditions of West Africa and the cultural practices of the Nok civilization.\n","-------------------\n","Benin Bronzes, from the Kingdom of Benin (present-day Nigeria), are a collection of brass and bronze sculptures and plaques dating back to the 13th century. Created using the lost-wax casting technique, these exquisite works of art depict a wide range of subjects, including royal figures, court officials, warriors, and animals.  The Benin Bronzes are renowned for their technical sophistication, intricate detail, and powerful representation of Benin's royal power and history. While many were looted during the British punitive expedition in 1897, they remain powerful symbols of African artistry and cultural heritage.\n","-------------------\n","Makonde sculpture, from Tanzania and Mozambique, is characterized by its distinctive ebony carvings, often depicting human figures with elongated limbs and expressive features. Makonde artists are known for their skillful use of ebony wood, creating intricate details and smooth, polished surfaces.  Traditional Makonde sculpture often represents spirits, ancestors, and mythological figures, reflecting the rich cultural beliefs and storytelling traditions of the Makonde people.  Contemporary Makonde artists continue to innovate, exploring new themes and styles while maintaining the distinctive aesthetic of this sculptural tradition.\n","-------------------\n","Dogon sculpture, from Mali, is closely linked to the religious and cosmological beliefs of the Dogon people.  Wooden masks and figures play a central role in Dogon rituals and ceremonies, representing ancestors, spirits, and mythical beings.  Dogon sculptures often feature stylized and abstract forms, with elongated figures and geometric patterns.  The materials used, the carving techniques, and the specific forms of the sculptures are all imbued with symbolic meaning, reflecting the deep connection between Dogon art and their spiritual worldview.\n","-------------------\n","Yoruba sculpture, from Nigeria, is renowned for its naturalistic representation of human figures, often depicting deities, ancestors, and rulers. Yoruba artists are skilled in carving wood, bronze, and terracotta, creating works that are both aesthetically beautiful and spiritually significant.  Yoruba sculpture often emphasizes the head and face, conveying a sense of dignity, power, and inner strength.  The sculptures are often used in religious rituals and ceremonies, embodying the rich cultural traditions and beliefs of the Yoruba people.\n","-------------------\n","Chokwe sculpture, from Angola, Democratic Republic of Congo, and Zambia, is characterized by its intricate carvings, often depicting human and animal figures with elaborate details.  Chokwe artists are skilled in working with wood, ivory, and other materials, creating sculptures that serve both aesthetic and ritual purposes.  Masks, figures, and other objects are used in initiation ceremonies, divination practices, and other cultural events, reflecting the social and spiritual significance of Chokwe art.\n","-------------------\n","Asante goldweights, from Ghana, are miniature brass sculptures that were used as counterbalances in weighing gold dust.  While serving a practical function, these small sculptures are also remarkable works of art, displaying intricate details and symbolic imagery.  Asante goldweights often depict animals, proverbs, or everyday objects, reflecting the cultural values and beliefs of the Asante people.  They are a testament to the Asante's artistic skill and their sophisticated understanding of metalworking techniques.\n","-------------------\n","Nutrition plays a vital role in maintaining overall health and well-being. A balanced and nutritious diet provides the body with the essential nutrients it needs to function properly, supporting growth, development, and disease prevention.  Nutrients, such as carbohydrates, proteins, fats, vitamins, and minerals, act as building blocks for cells, tissues, and organs, fueling bodily processes and enabling the body to perform its various functions.  Proper nutrition contributes to a strong immune system, healthy weight management, increased energy levels, and improved cognitive function.  Understanding the role of nutrition and making informed food choices are crucial for achieving and sustaining optimal health throughout life.\n","-------------------\n","Healthy eating involves consuming a variety of nutrient-rich foods from different food groups in appropriate portions.  A balanced diet typically includes fruits, vegetables, whole grains, lean proteins, and healthy fats.  Fruits and vegetables provide essential vitamins, minerals, and fiber, contributing to overall health and disease prevention. Whole grains offer complex carbohydrates and fiber, promoting satiety and supporting digestive health.  Lean proteins, such as fish, poultry, beans, and nuts, are crucial for building and repairing tissues.  Healthy fats, found in avocados, nuts, and olive oil, provide essential fatty acids and support various bodily functions.  Limiting processed foods, sugary drinks, and excessive intake of saturated and unhealthy fats is also key to maintaining a healthy diet.\n","-------------------\n","Food groups categorize foods based on their nutrient content and provide a framework for building a balanced diet.  The major food groups include fruits, vegetables, grains, protein foods, and dairy (or dairy alternatives).  Fruits and vegetables are rich in vitamins, minerals, and fiber.  Grains, particularly whole grains, provide carbohydrates and fiber.  Protein foods, such as meat, poultry, fish, beans, and nuts, supply essential amino acids for building and repairing tissues.  Dairy products (or alternatives) offer calcium and vitamin D, which are crucial for bone health.  Understanding the nutrient contributions of each food group enables individuals to make informed choices and create meals that meet their nutritional needs.\n","-------------------\n","The food we consume has a profound impact on our physical and mental well-being.  Nutrients from food provide the energy needed for daily activities, support growth and development, and play a crucial role in maintaining bodily functions.  A healthy diet can boost the immune system, protect against chronic diseases, and improve cognitive function.  Conversely, a diet lacking in essential nutrients or high in unhealthy components can lead to nutrient deficiencies, weakened immunity, weight gain, and an increased risk of chronic diseases such as heart disease, diabetes, and certain types of cancer.  Understanding the connection between food and health empowers individuals to make dietary choices that promote well-being and enhance quality of life.\n","-------------------\n","Nutritional needs vary throughout different stages of life.  During childhood and adolescence, adequate nutrition is crucial for growth and development.  Pregnant and breastfeeding women require increased amounts of certain nutrients to support the health of both mother and child.  As individuals age, their metabolism slows down, and their nutritional requirements may change.  Older adults may need to focus on consuming nutrient-dense foods to maintain muscle mass, bone health, and cognitive function.  Adapting dietary choices to meet the specific nutritional needs of each life stage is essential for promoting health and well-being.\n","-------------------\n","Water is essential for life, playing a vital role in numerous bodily functions.  It helps regulate body temperature, transport nutrients, remove waste products, and lubricate joints.  Staying adequately hydrated is crucial for maintaining overall health and well-being.  Fluid needs can vary depending on factors such as activity level, climate, and individual health conditions.  Water is the best choice for hydration, but other beverages, such as unsweetened tea and fruit-infused water, can also contribute to daily fluid intake.  Paying attention to thirst cues and consuming fluids throughout the day is essential for maintaining proper hydration and supporting optimal bodily function.\n","-------------------\n","Making informed food choices involves reading food labels, understanding portion sizes, and being aware of the nutritional content of different foods.  Food labels provide valuable information about serving sizes, calories, macronutrients (carbohydrates, proteins, and fats), and micronutrients (vitamins and minerals).  Portion control helps manage calorie intake and maintain a healthy weight.  Choosing nutrient-dense foods, those that provide a high amount of nutrients relative to their calorie content, ensures that the body receives the essential vitamins and minerals it needs.  By developing an understanding of nutrition and applying this knowledge to daily food choices, individuals can make informed decisions that support their health and well-being.\n","-------------------\n","A gnawing hunger pulsed in young Abeni's belly. The drought had withered the crops, leaving the village with little to eat. Determined to find sustenance, Abeni ventured into the nearby forest, her eyes scanning the undergrowth.  She remembered her grandmother's tales of sweet, wild berries that grew in hidden clearings. After hours of searching, her efforts were rewarded: a patch of plump, juicy berries.  Abeni carefully gathered them, her heart filled with relief.  The berries wouldn't solve the village's crisis, but they offered a temporary reprieve, a small taste of hope amidst the hardship.\n","-------------------\n","The emptiness in Musa's stomach echoed the emptiness of the fishing nets.  The once-abundant river had dwindled to a trickle, and the fish had disappeared.  But Musa refused to give up. He remembered a hidden fishing hole, a place his grandfather had shown him, where the fish were said to gather even in the driest seasons. Driven by hunger and a glimmer of hope, Musa set off, his fishing rod his only companion. The journey was long and arduous, but the thought of a fresh catch spurred him on. Would the fishing hole live up to its legend, or would Musa's hunger remain unsatisfied?\n","-------------------\n","The scorching sun beat down on young Khadija as she trekked across the arid landscape.  Days had passed since her last proper meal, and her stomach ached with hunger.  In the distance, she spotted a majestic baobab tree, its branches laden with large, gourd-like fruit.  Khadija knew that the baobab fruit, with its powdery pulp, was a valuable source of nourishment in times of scarcity.  Hope surged through her weary limbs.  The baobab fruit promised sustenance, a chance to replenish her energy and continue her journey through the harsh, unforgiving terrain.\n","-------------------\n","The forest was alive with the buzzing of bees, a sound that both intrigued and intimidated young Jabari. He hadn't eaten in days, and his hunger was a constant companion.  He had heard stories of wild honeycombs hidden high in the trees, a sweet and energy-rich treat.  Despite his fear of the bees, Jabari's hunger spurred him to action.  He carefully climbed a towering tree, his eyes searching for the telltale signs of a honeycomb.  The risk was great, but the reward – the sweet taste of honey – was a chance to silence the gnawing emptiness in his stomach.\n","-------------------\n","The desert wind whipped around Fatima as she scanned the sandy ground.  The nomadic community was facing a lean season, and food was scarce.  Fatima, remembering her mother's teachings, was searching for desert truffles, a hidden delicacy that grew beneath the sand after the rains.  These rare fungi, if found, would provide a much-needed source of nutrition for her family.  The search was arduous, the truffles elusive, but Fatima's determination was fueled by the hope of finding this hidden bounty and bringing sustenance to her people.\n","-------------------\n","The rumble of his empty stomach was drowned out by the cacophony of the city market.  Adesina, a young man new to the urban sprawl, had come with little money but a large appetite.  The market was a sensory overload – the vibrant colors of fruits and vegetables, the enticing aromas of street food, the boisterous calls of vendors.  Adesina's hunger guided him through the labyrinthine stalls.  He hoped to find a kind vendor willing to offer him a scrap of food or a chance to earn a meal through labor.  The market represented both opportunity and uncertainty, a place where his hunger might be satisfied or intensified.\n","-------------------\n","When thirst strikes, the most obvious and effective solution is water.  Pure, clean water is the best way to rehydrate your body and replenish lost fluids.  It's essential for regulating body temperature, transporting nutrients, and keeping your organs functioning properly.  Keep a reusable water bottle with you and refill it throughout the day, especially in hot weather or after physical activity.  There's no substitute for the refreshing and revitalizing power of plain water.\n","-------------------\n","Freshly squeezed fruit juices offer a delicious and hydrating way to quench your thirst. They provide a burst of flavor along with essential vitamins and minerals.  Opt for juices with no added sugar to avoid unnecessary calories.  Citrus fruits like oranges and grapefruit are particularly refreshing, as are tropical fruits like mangoes and pineapples.  A glass of chilled fruit juice can be a revitalizing treat on a hot day or after a workout.\n","-------------------\n","Herbal teas, both hot and iced, can be a soothing and flavorful way to address thirst.  Teas like peppermint, chamomile, and hibiscus offer a variety of tastes and potential health benefits.  They are naturally caffeine-free and can be enjoyed throughout the day.  Brewing your own herbal tea allows you to control the strength and sweetness.  A cool glass of iced hibiscus tea or a warm cup of chamomile can be a comforting and hydrating choice when you're feeling thirsty.\n","-------------------\n","Coconut water, naturally extracted from young coconuts, is a refreshing and electrolyte-rich beverage that's perfect for rehydration.  It contains potassium, sodium, and magnesium, which are lost through sweat.  Coconut water is a healthy alternative to sugary sports drinks, providing natural hydration without the added calories and artificial ingredients.  Its slightly sweet and nutty flavor makes it a delicious and thirst-quenching option, especially after physical exertion.\n","-------------------\n","Infused water is a simple and customizable way to add flavor and enjoyment to your hydration routine.  By adding slices of fruits, vegetables, or herbs to your water, you can create refreshing and flavorful combinations that encourage you to drink more.  Cucumber and mint, lemon and ginger, or strawberry and basil are popular choices.  Infused water is a healthy and low-calorie way to stay hydrated throughout the day, adding a touch of variety and excitement to plain water.\n","-------------------\n","Smoothies can be a delicious and nutritious way to combat thirst while also providing a substantial boost of vitamins, minerals, and fiber.  By blending fruits, vegetables, yogurt, or milk, you can create a thick and satisfying drink that's packed with nutrients.  Smoothies are a versatile option, allowing you to experiment with different flavor combinations and tailor them to your dietary needs.  A refreshing smoothie can be a meal replacement, a post-workout recovery drink, or simply a tasty way to quench your thirst and nourish your body.\n","-------------------\n","Sports drinks, designed to replenish electrolytes lost during intense physical activity, can be helpful in specific situations.  However, it's important to consume them in moderation due to their high sugar content.  If you've engaged in prolonged or strenuous exercise, a sports drink can help replace electrolytes and fluids.  But for everyday hydration, water and other healthier options are generally recommended. Opt for low-sugar or electrolyte-enhanced water instead if you're not engaging in intense exercise.\n","-------------------\n","Aisha treasured the necklace her grandmother had given her. It was a simple string of beads, but it held immense sentimental value. One day, she realized it was missing. Panic welled up inside her.  So she went looking for the necklace, retracing her steps, searching every nook and cranny of her home. She looked under furniture, in drawers, and even in the garden, her heart pounding with each passing moment.  Would she find her precious necklace, or would it be lost forever?\n","-------------------\n","The village elder was gravely ill, and the traditional healer needed a rare herb to prepare a cure.  The herb, known for its healing properties, grew only in the remote mountains.  Young Adebayo, known for his bravery and knowledge of the wilderness, volunteered to retrieve it. So he went looking for the rare herb, embarking on a perilous journey through treacherous terrain and unpredictable weather.  The fate of the elder, and perhaps the entire village, rested on his success.\n","-------------------\n","Musa, a young adventurer with a thirst for exploration, had heard tales of a hidden waterfall, said to possess magical properties. The waterfall, shrouded in mist and legend, was rumored to be located deep within a dense forest.  Intrigued by the stories and eager to witness its beauty, Musa set out on an expedition.  So he went looking for the legendary waterfall, navigating through thick vegetation, crossing treacherous rivers, and facing unknown dangers.  Would his quest lead him to the mythical falls, or would the forest keep its secrets hidden?\n","-------------------\n","Professor Abimbola, a renowned historian, had dedicated her life to unraveling the mysteries of Africa's past.  She had heard whispers of an ancient manuscript, rumored to contain valuable historical information about a lost civilization.  The manuscript, said to be hidden in a forgotten library, held the key to unlocking a crucial piece of African history.  Driven by her passion for knowledge, Professor Abimbola embarked on a quest. So she went looking for the ancient manuscript, traveling to remote villages, exploring dusty archives, and interviewing local elders, hoping to uncover the truth behind the legend.\n","-------------------\n","Little Kofi loved mangoes more than anything.  He dreamt of finding the perfect mango – the ripest, juiciest, most flavorful mango imaginable.  One sunny afternoon, with the scent of mangoes filling the air, Kofi set off on an adventure.  So he went looking for the perfect mango, exploring the market stalls, inspecting each fruit with meticulous care, his senses heightened by anticipation.  Would he find the mango of his dreams, the one that would satisfy his craving and make this day truly special?\n","-------------------\n","The cooking pot sat empty on the fire, a stark reminder of the family's dwindling food supply.  Young Amina's stomach grumbled loudly.  She knew her family was relying on her.  Was hungry, so she went looking for anything she could find to fill their bellies.  She ventured into the forest, her eyes scanning the trees for edible fruits, her hands brushing through the undergrowth, searching for roots or wild vegetables. The sun beat down on her back, but Amina pressed on, driven by the need to provide for her loved ones.\n","-------------------\n","The once-flowing river had been reduced to a series of muddy puddles by the relentless drought.  Chukwuemeka, the village's skilled fisherman, felt the pangs of hunger gnawing at him.  His family depended on the river's bounty, but the fish had disappeared along with the water.  Was hungry, so he went looking for alternative sources of food.  He knew of a distant watering hole, rumored to still hold some life.  The journey would be long and dangerous, but Chukwuemeka was determined to return with something to feed his family.\n","-------------------\n","The meager harvest had left the village granaries almost bare.  Little Fatima, her small frame already thin, felt the constant ache of hunger.  She watched her mother worry, and her heart ached.  Was hungry, so she went looking for scraps of food that might have been overlooked.  She scoured the fields for fallen grains, searched the forest floor for edible mushrooms, and even ventured close to the village outskirts, hoping to find wild berries or roots.  Every morsel she found was a small victory, a step towards alleviating her family's hunger.\n","-------------------\n","The family's herd of cattle, their primary source of milk and meat, had wandered off during a dust storm.  Jabari, the eldest son, felt the responsibility weigh heavily on his shoulders.  He knew his family's survival depended on finding the lost animals.  Was hungry, so he went looking for the missing cattle, tracking their faint hoofprints across the parched earth. The scorching sun and the vastness of the savanna made the search daunting, but Jabari was determined to bring the cattle home and ensure his family's well-being.\n","-------------------\n","The market, usually bustling with activity, was eerily quiet.  The drought had taken its toll, and the vendors' stalls were mostly empty.  Aisha, a young woman with a resourceful spirit, felt the familiar pang of hunger.  Was hungry, so she went looking for any opportunity to earn food or trade for it. She offered her services as a laborer, helped carry heavy loads, and even tried her hand at bartering small trinkets she had made.  Aisha's determination to survive fueled her efforts, as she navigated the challenges of the struggling market.\n","-------------------\n","The old, abandoned garden at the edge of the village was overgrown with weeds and vines.  But Adesina, a young boy with a keen eye and a green thumb, remembered stories of its once-abundant bounty.  With his family facing food shortages, Adesina saw an opportunity.  Was hungry, so he went looking for a way to revive the forgotten garden. He cleared the weeds, tilled the soil, and planted seeds, hoping to coax life back into the neglected plot.  The garden represented a chance for Adesina to contribute to his family's well-being and bring new life to a forgotten corner of the village.\n","-------------------\n","Jollof rice is a beloved West African one-pot rice dish cooked in a flavorful tomato and pepper stew. The rice absorbs a rich blend of spices, giving it a vibrant red-orange color and a smoky, spicy taste. It is often served at celebrations and gatherings alongside fried plantains or coleslaw.\n","-------------------\n","Egusi soup is a hearty West African stew made with ground melon seeds (egusi), leafy greens, and often meat or fish. It has a thick texture and savory flavor enriched with palm oil and local spices. This comforting soup is typically served with a starchy side like fufu or pounded yam for dipping.\n","-------------------\n","Suya is a popular Nigerian street food consisting of skewered, spiced grilled meat. Thin strips of beef or chicken are marinated in a dry rub made of ground peanuts, chili powder, and spices, then grilled over open flames. The result is tender, smoky meat with a spicy kick, often served with fresh onions and tomatoes.\n","-------------------\n","Fufu is a soft, dough-like staple common in many parts of Africa, especially West and Central Africa. It is made by boiling starchy foods like cassava, yam, or plantain and pounding them into a smooth mash. Fufu is usually formed into balls and served with soups or stews, used to scoop up the flavorful sauces.\n","-------------------\n","Chicken Yassa is a tangy West African dish from Senegal made with marinated chicken. The chicken is slow-cooked with lots of onions, lemon juice, and mustard, creating a savory sauce with a citrus kick. The tender, flavorful chicken is typically served over rice or couscous.\n","-------------------\n","Thieboudienne is a classic Senegalese dish of fish and seasoned rice, often considered Senegal's national dish. It features pieces of fish stuffed with herbs, cooked in a rich tomato-based sauce with vegetables like carrots, cabbage, and cassava. The flavorful sauce is absorbed by the rice, making it a hearty and satisfying meal.\n","-------------------\n","Waakye is a popular Ghanaian dish of rice and beans cooked together. The rice is colored with sorghum leaves, giving it a reddish-brown tint, and cooked with black-eyed peas or red beans. Often served with a stew, spaghetti, garri, or fried plantains on the side, waakye is a filling meal typically eaten for breakfast or lunch.\n","-------------------\n","Teju was hungry so he went looking for a hot serving of Jollof rice, drawn by the rich aroma of tomatoes and spices at the bustling street market.\n","-------------------\n","Kwame was hungry so he went looking for a comforting bowl of Egusi soup, eager to enjoy its blend of ground melon seeds, tender meat, and local spices.\n","-------------------\n","Kofi was hungry so he went looking for a plate of sizzling Suya, attracted by the smoky scent of spiced, grilled meat cooking over an open flame.\n","-------------------\n","Amina was hungry so she went looking for a serving of soft, pounded Fufu accompanied by a savory stew, a meal that promised the warmth of home-cooked comfort.\n","-------------------\n","Ibrahim was hungry so he went looking for a steaming bowl of matoke, drawn by the scent of cooked green plantains simmered in a tangy tomato sauce at a local eatery.\n","-------------------\n","Fatima was thirsty so she went looking for a refreshing cup of Rooibos tea, and soon discovered a quaint tea shop in Cape Town serving the naturally sweet, caffeine-free brew.\n","-------------------\n","Ahmed was hungry so he went looking for a plate of couscous, guided by the enticing aroma of spiced, fluffy semolina paired with a hearty vegetable stew at a bustling Moroccan restaurant.\n","-------------------\n","Salma was thirsty so she went looking for a cup of Moroccan mint tea, and in a sunlit courtyard café, she savored the aromatic blend of green tea and fresh mint leaves with just the right sweetness.\n","-------------------\n","Bolanle was hungry so she went looking for Banku and tilapia, and soon she was enjoying the traditional Ghanaian dish of fermented corn dough paired with perfectly grilled, spice-rubbed tilapia.\n","-------------------\n","Chinedu was thirsty so he went looking for Tella, a traditional Ethiopian beer, and discovered it at a local gathering where its tangy, malty flavor provided a refreshing pause from his day.\n","-------------------\n","Ngozi was hungry so she went looking for Maafe, a rich peanut stew, and her search led her to a small diner where the savory blend of ground peanuts and tender meat promised to satisfy her appetite.\n","-------------------\n","Siyabonga was thirsty so he went looking for Umqombothi, a traditional South African beer, and found it being shared at a community gathering, offering a unique taste of local heritage.\n","-------------------\n","Lamin was hungry so he went looking for a plate of Kelewele, and his quest led him to a street vendor whose spicy fried plantains, seasoned with ginger and chili, were a popular local snack.\n","-------------------\n","Sade was thirsty so she went looking for sugarcane juice, and at a vibrant market stall, she found the fresh, naturally sweet beverage that quenched her thirst on a sweltering day.\n","-------------------\n","Zuri was thirsty so she went looking for a glass of refreshing Bissap, the tangy hibiscus drink that offered a cool burst of flavor on a hot day.\n","-------------------\n","Laila was thirsty so she went looking for a taste of freshly tapped Palm wine, drawn by its sweet and slightly tangy flavor cherished in her community.\n","-------------------\n","Musa was thirsty so he went looking for a chilled glass of Ginger beer, its spicy and fizzy allure promising to cool him down after a long day in the sun.\n","-------------------\n","Amara was thirsty so she went looking for a cup of Kenyan chai, the aromatic blend of spiced tea and milk serving as a soothing remedy for her parched senses.\n","-------------------\n","Banku and tilapia is a common dish in Ghana, featuring a fermented corn and cassava dough (banku) served with grilled fish. The banku is cooked into smooth white balls with a slightly sour taste. It is paired with a whole tilapia fish that has been spiced and grilled, and usually accompanied by a spicy pepper sauce for dipping.\n","-------------------\n","Maafe, also known as groundnut stew, is a rich West African peanut-based stew. It is made by simmering meat (such as beef, lamb, or chicken) and vegetables in a creamy sauce of ground peanuts or peanut butter. The stew is savory and slightly sweet, often served with rice, couscous, or a side of fufu.\n","-------------------\n","Attiéké is a traditional Ivorian side dish made from fermented cassava pulp that is grated into couscous-like grains. It has a light, slightly tangy flavor and a texture similar to couscous. Attiéké is often served with grilled fish or meat and a fresh tomato and onion relish.\n","-------------------\n","Moimoi is a savory Nigerian steamed pudding made from blended black-eyed peas. The bean batter is mixed with onions, peppers, and spices, and sometimes enriched with fish, egg, or meat, then steamed in leaves or small containers. The result is a protein-rich, flavorful side dish often eaten with rice, garri, or bread.\n","-------------------\n","Pepper soup is a light, spicy soup popular in West Africa, known for its fiery broth infused with local herbs and spices. It can be made with various meats or fish – common versions include goat meat, catfish, or chicken. The clear broth is intensely flavored and often enjoyed as a warm comfort food or a remedy for colds.\n","-------------------\n","Banga soup is a rich palm nut soup from southern Nigeria. It is made by extracting the juice from palm fruit and cooking it with spices, aromatic herbs, and typically fish or meat. The soup has a deep reddish-orange color and a unique earthy flavor, usually enjoyed with starches like fufu, eba, or pounded yam.\n","-------------------\n","Efo riro is a flavorful vegetable stew from Nigeria, particularly the Yoruba cuisine. It features leafy greens such as spinach or amaranth cooked with bell peppers, onions, and tomatoes, and often includes bits of meat or fish. Seasoned with local spices and crayfish, this thick stew is typically eaten with fufu or pounded yam.\n","-------------------\n","Kelewele is a Ghanaian snack made of ripe plantains that are seasoned and fried. The plantain pieces are cut into cubes or slices and marinated in a mixture of spices like ginger, chili, and garlic before deep-frying. The result is a plate of golden-brown, crispy plantain bites that are spicy, slightly sweet, and often sold by street vendors as a quick snack.\n","-------------------\n","Akara are West African bean fritters made from puréed black-eyed peas. The batter is seasoned with onions, salt, and sometimes peppers, then deep-fried into ball or patty shapes. Crispy on the outside and soft on the inside, akara are often enjoyed as a breakfast item or snack, sometimes sandwiched in bread.\n","-------------------\n","Puff-puff is a popular West African fried dough snack. Made from a yeast-raised batter of flour, sugar, and water, it is deep-fried until golden brown. The bite-sized balls are slightly sweet and chewy, often eaten as a street snack or served at parties, sometimes dusted with sugar.\n","-------------------\n","Ugali is a dense maize porridge that is a staple in East Africa, especially in Kenya and Tanzania. It is made by cooking cornmeal with water until it thickens into a stiff dough-like consistency. Ugali is usually served in a mound and eaten with the hands, alongside stews or sauces, to scoop up flavorful bites.\n","-------------------\n","Nyama choma means \"grilled meat\" in Swahili and is a favorite East African barbecue dish. Typically made with goat or beef, the meat is lightly seasoned, slow-roasted over charcoal, and served chopped into pieces. The tender, smoky meat is often enjoyed with sides like ugali and kachumbari (a fresh tomato and onion salad).\n","-------------------\n","Injera is a spongy, sour flatbread made from fermented teff flour, a staple in Ethiopia and Eritrea. It has a unique, slightly tangy flavor and a soft, pancake-like texture full of tiny air pockets. Injera is used as both a plate and utensil: various stews and curries are served on top of it, and pieces of the bread are torn off to scoop up the food.\n","-------------------\n","Doro Wat is a spicy Ethiopian chicken stew, often considered the country’s signature dish. It is prepared with chicken pieces slow-cooked in a berbere spice-infused sauce made from onions, garlic, and spiced butter. The stew is rich, deep red in color, and traditionally served with boiled eggs and injera, which is used to scoop up the thick sauce.\n","-------------------\n","Pilau in East Africa refers to a fragrant spiced rice dish, especially popular in Kenya and Tanzania. The rice is cooked with meat (like beef or goat), broth, and aromatic spices such as cumin, cardamom, and cloves, giving it a brown color and rich flavor. Often served at special occasions, Swahili pilau is enjoyed with a side of kachumbari salad.\n","-------------------\n","Matoke is a beloved dish in Uganda and parts of East Africa made from green plantains. The plantains are peeled, wrapped in banana leaves, and steamed or boiled until soft, then mashed. Often, matoke is served with a sauce or stew (such as a peanut or meat sauce), and it has a mild, starchy flavor that complements flavorful curries and stews.\n","-------------------\n","Rolex is a popular Ugandan street food consisting of an omelette rolled inside a chapati flatbread. To make a rolex, a thin omelette is cooked with chopped tomatoes, onions, and cabbage, then placed on a warm chapati and rolled up. It is a convenient, tasty meal-on-the-go, especially loved by students and travelers.\n","-------------------\n","Githeri is a simple but hearty Kenyan dish made from a mixture of corn and beans. Traditionally, maize kernels and kidney beans (or local beans) are boiled together and can be eaten as is or fried with onions and vegetables for extra flavor. This filling one-pot meal is a staple in many Kenyan households and is prized for its nutritional value and simplicity.\n","-------------------\n","Sukuma wiki is a savory collard greens dish popular in East Africa, particularly Kenya and Tanzania. The name means \"stretch the week\" in Swahili, as it is an affordable way to extend meals. The greens are chopped and sautéed with onions, tomatoes, and a bit of oil until tender. Often served alongside ugali or other staples, it’s a nutritious accompaniment to many meals.\n","-------------------\n","Mandazi are East African fried dough buns, similar to donuts but less sweet. The dough is made from flour, yeast, sugar, and coconut milk or water, sometimes spiced with cardamom. It is cut into triangular or round shapes and deep-fried until puffy and golden brown. Mandazi are often eaten as a breakfast treat or snack, sometimes paired with chai tea.\n","-------------------\n","Kitfo is a traditional Ethiopian dish made of finely minced beef, often served raw or lightly sautéed. The meat is mixed with niter kibbeh (Ethiopian spiced butter) and seasoned with mitmita, a spicy chili powder. Rich and buttery, kitfo is typically accompanied by injera or a mild cheese called ayib to balance the heat.\n","-------------------\n","Ndolé is a flavorful Cameroonian stew made with bitter greens (often bitterleaf or spinach) and ground peanuts. The stew often includes pieces of beef, shrimp, or fish, which simmer in a rich, creamy peanut sauce that balances the slight bitterness of the greens. Ndolé is commonly served with plantains, rice, or fufu, making a hearty and traditional meal.\n","-------------------\n","Saka-saka, also known as cassava leaves stew or pondu, is a staple dish in Central Africa, especially in the Congo region. Fresh cassava leaves are pounded and boiled with ingredients like peanut paste, palm oil, garlic, and sometimes fish or meat. The result is a green, hearty stew with a slightly nutty flavor, usually served with fufu, rice, or plantains.\n","-------------------\n","Chicken Moambe (Poulet Moambé) is a famous Central African dish of chicken cooked in a rich palm nut sauce. The sauce is made from red palm fruit pulp, giving it a thick consistency and reddish color, and is seasoned with spices and aromatics. The tender chicken absorbs the savory sauce, and the dish is often served with rice, cassava, or plantain. It’s considered a national dish in countries like the Democratic Republic of Congo.\n","-------------------\n","Chikwangue (also called kwanga) is a fermented cassava loaf popular in Central African countries like the Congo. To make chikwangue, cassava is fermented, pounded into a dough, then wrapped tightly in banana or plantain leaves and boiled. The result is a firm, sticky tube of starch with a slightly sour taste, sliced and served as a side to stews and sauces, much like fufu.\n","-------------------\n","Brochettes are a popular East and Central African grilled meat skewer, similar to kebabs. In countries like Rwanda and Burundi, brochettes usually feature chunks of marinated goat or beef threaded on a stick and grilled over open coals. They come out smoky and juicy, often served with grilled plantains or potatoes, and make for a common barbecued street food or bar snack.\n","-------------------\n","Couscous is a staple dish in North Africa made from tiny steamed balls of semolina wheat. It is often served as a base for a hearty meal: tender vegetables, chickpeas, and meat (such as lamb or chicken) are cooked in a spiced broth and spooned over the fluffy couscous. This comforting dish is commonly enjoyed in countries like Morocco, Algeria, and Tunisia.\n","-------------------\n","Tagine is a slow-cooked Moroccan stew named after the cone-lidded clay pot in which it’s cooked. A tagine can be made with various meats (like lamb, chicken, or beef) and vegetables, simmered gently with spices such as cumin, ginger, and turmeric. The result is a tender, aromatic dish often combining sweet and savory elements (for example, apricots or olives with meat), traditionally served with bread.\n","-------------------\n","Koshary (Koshari) is a filling Egyptian street food dish that layers various staples together. It typically includes rice, macaroni pasta, and lentils at its base, topped with chickpeas and crispy fried onions. A tangy spiced tomato sauce and a splash of garlic-vinegar dressing are poured over the mix. The result is a comforting, carb-rich bowl that’s enjoyed as a quick meal by many in Egypt.\n","-------------------\n","Ful medames is a traditional Egyptian breakfast dish made from slow-cooked fava beans. The beans are simmered until soft and then mashed or left whole, typically seasoned with olive oil, garlic, lemon juice, and salt. Often garnished with chopped parsley, tomato, or a boiled egg, ful medames is a hearty and nutritious meal usually scooped up with bread.\n","-------------------\n","Shakshuka is a North African and Middle Eastern dish of eggs poached in a spiced tomato and pepper sauce. The base is made by simmering tomatoes, bell peppers, onions, and spices like cumin and paprika until thick and rich. Eggs are cracked into this savory sauce and cooked until just set. Served hot, often in the same pan, shakshuka is commonly eaten with bread to mop up the flavorful sauce, making it a popular breakfast or brunch.\n","-------------------\n","Brik is a crispy Tunisian pastry turnover commonly filled with egg and tuna. A thin dough called malsouka or warqa is used to encase a mixture that often includes a whole egg, chopped onions, parsley, and sometimes capers or ground meat. The filled packet is then deep fried to a golden brown. Eaten hot, brik has a satisfying crunch on the outside and a savory, soft filling.\n","-------------------\n","Harira is a warming Moroccan soup made with tomatoes, lentils, chickpeas, and often small amounts of meat like lamb. It’s seasoned with spices such as cumin, turmeric, and cinnamon, giving it a fragrant aroma. This hearty soup is traditionally eaten to break the fast during Ramadan, often accompanied by dates or honeyed pastries, but it’s enjoyed year-round as well.\n","-------------------\n","Pastilla (B’stilla) is a sweet and savory Moroccan meat pie. It is traditionally made with pigeon or chicken meat cooked with spices, and layered in a thin flaky pastry called warqa along with an egg-based sauce and crushed almonds. The pie is baked until crisp and golden, then dusted with powdered sugar and cinnamon. The combination of spiced meat and sweet topping makes pastilla a unique dish often reserved for special occasions.\n","-------------------\n","Molokhia is a green leafy soup or stew popular in Egypt and parts of North Africa, made from finely chopped jute leaves. The leaves are cooked in a broth often flavored with garlic and coriander, resulting in a thick, slightly viscous soup. It is commonly prepared with chicken or rabbit, and served over rice or with flatbread, offering a distinct earthy flavor and a nutritious meal.\n","-------------------\n","Pap is a thick maize porridge that is a staple throughout Southern Africa. It is made by boiling cornmeal with water and stirring until it becomes a smooth, stiff porridge. Pap (known by different names like sadza or nshima in other countries) is usually served in a mound and eaten with flavorful relishes, stews, or grilled meats. Diners pinch off a bit of pap with their fingers to scoop up the accompanying dishes.\n","-------------------\n","Chakalaka is a spicy South African vegetable relish often served at barbecues (braais) and with staple foods like pap. It typically consists of tomatoes, onions, bell peppers, carrots, and beans cooked down with curry powder and chili for heat. The result is a tangy, mildly hot relish that adds flavor and kick to grilled meat or starches. It can be served hot or at room temperature as a side dish.\n","-------------------\n","Bunny chow is a South African fast food dish that originated in the city of Durban. It consists of a hollowed-out half or quarter loaf of bread filled to the brim with a spicy curry, often made with chicken, mutton, or beans. The curry soaks into the soft bread bowl, and the scooped-out bread chunk (called the \"virgin\") is used to dip and eat the flavorful filling. It's a hearty, portable meal popular for its bold flavors.\n","-------------------\n","Bobotie is a classic South African casserole made with curried minced meat, fruit, and a creamy egg topping. Ground beef or lamb is cooked with spices like curry powder and turmeric, plus additions such as onions, garlic, and dried fruit (often raisins or apricots) for a touch of sweetness. The mixture is spread in a baking dish, topped with a mixture of egg and milk, and baked until set and golden. The result is a savory-sweet dish, usually served with yellow rice and chutney.\n","-------------------\n","Biltong is a popular Southern African snack of cured, dried meat, similar to beef jerky. Strips of meat (often beef, but also game like kudu or ostrich) are marinated in vinegar and spices such as salt, coriander, and pepper, then air-dried until they become chewy and shelf-stable. Biltong is high in protein and flavor, making it a favored snack for road trips, hiking, or enjoying with a drink.\n","-------------------\n","Potjiekos, meaning \"pot food\" in Afrikaans, is a traditional South African stew cooked outdoors in a cast-iron pot. Ingredients like meat (often beef or mutton), vegetables, and potatoes are layered in the pot with spices and some liquid, then simmered slowly over coals without stirring. The slow cooking infuses flavors and yields tender results. Served directly from the pot, potjiekos is a communal dish often enjoyed at social gatherings.\n","-------------------\n","Boerewors is a thick, spiral-shaped sausage that is a staple of South African cuisine, especially at braais (barbecues). The name means \"farmer's sausage\" in Afrikaans, and it is made from coarsely ground beef (sometimes mixed with pork or lamb) and generously seasoned with spices like coriander, black pepper, and nutmeg. Grilled over charcoal, boerewors is juicy and flavorful, often served with pap or on a bread roll with mustard and relish.\n","-------------------\n","Vetkoek is a traditional South African fried dough bread. The word \"vetkoek\" means \"fat cake\" in Afrikaans, reflecting the cooking method of deep-frying yeasted dough. The result is a round, golden-brown bread with a crispy outside and soft inside. Vetkoek can be enjoyed plain or split open and filled with savory mince curry or spread with butter and jam for a sweet treat.\n","-------------------\n","Malva pudding is a sweet dessert from South Africa, known for its moist texture and rich taste. It is a baked sponge pudding made with apricot jam in the batter, which gives it a distinct flavor and caramelized exterior. After baking, a warm butter-cream sauce is poured over the pudding, allowing it to soak in and become sticky and soft. Malva pudding is often served warm with custard or ice cream.\n","-------------------\n","Peri-peri chicken is a spicy grilled chicken dish popular in parts of Southern Africa, especially Mozambique and South Africa. The chicken is marinated in a fiery sauce made from peri-peri chili peppers (also known as piri-piri), garlic, lemon, and herbs, then grilled or roasted. The result is juicy chicken with a flavorful kick of heat and tang. Often served with fries, rice, or a salad, peri-peri chicken has gained international fame and is a staple at many barbecues.\n","-------------------\n","Matapa is a traditional Mozambican dish made from cassava leaves cooked in a peanut sauce. The finely chopped cassava leaves are simmered with ground peanuts (or peanut butter), garlic, and often coconut milk, which creates a rich, creamy green stew. Sometimes shrimp or crab is added for extra flavor. Matapa is typically served with rice or xima (a cornmeal porridge), offering a hearty meal with a nutty and slightly sweet taste.\n","-------------------\n","Kapenta are small dried freshwater fish, a popular staple in Zimbabwe and Zambia. The tiny fish (similar to sardines) are often sun-dried to preserve them. To prepare, they are typically fried with tomatoes, onions, and spices to create a savory relish. Kapenta are eaten alongside sadza (maize porridge) or rice, providing a crunchy texture and a concentrated fish flavor that is rich in protein and minerals.\n","-------------------\n","Bissap is a popular West African drink made from dried hibiscus flowers. The petals are boiled and sweetened with sugar (and sometimes flavored with ginger or mint) to create a bright red, tangy beverage. Served chilled, bissap is very refreshing and is often enjoyed at social gatherings and as a street-side refreshment, known in some regions as hibiscus tea or by other names like sobolo or zobo.\n","-------------------\n","Palm wine is a traditional naturally fermented drink made from the sap of palm trees. The fresh sap is collected by tapping the tree and has a sweet taste; it then ferments quickly, resulting in a milky-white beverage with a slight fizz and a low alcohol content. Palm wine is enjoyed in many West and Central African communities, often served fresh in calabashes or bottles and used in ceremonies and gatherings.\n","-------------------\n","Ginger beer in the African context refers to a spicy, homemade ginger drink that can be non-alcoholic or lightly fermented. It is prepared by steeping crushed ginger root in water with sugar (and sometimes adding pineapple peels or chili for extra flavor) and allowing it to brew. The result is a refreshing, fizzy beverage with a strong ginger kick, served cold to quench thirst on hot days.\n","-------------------\n","Kunu is a mildly sweet, non-alcoholic drink from northern Nigeria made from grains like millet or sorghum. The grains are soaked, ground, and mixed with spices such as ginger and sometimes cloves or pepper, then left to ferment slightly. After straining, the drink has a smooth, creamy texture and is enjoyed chilled. Kunu is filling and nutritious, often served as a refreshing beverage on hot days.\n","-------------------\n","Fura da nono is a traditional drink in parts of West Africa, especially among the Fulani people. It consists of fura (small millet dough balls) blended into nono (fermented cow’s milk) to create a smoothie-like beverage. The drink is thick, slightly sour, and can be spiced with ginger or chili. Fura da nono is both refreshing and filling, often consumed as a light meal or to cool off in hot weather.\n","-------------------\n","Chapman is a fruity non-alcoholic punch that originated in Nigeria, commonly served at parties and bars. It’s made by mixing fizzy orange soda and clear soda (like lemon-lime) with blackcurrant syrup (such as Ribena) or grenadine, plus a dash of Angostura bitters for complexity. The drink is bright reddish-orange and typically served in a large mug filled with ice, garnished with slices of cucumber, orange, and sometimes a squeeze of lemon. Sweet and slightly tangy, Chapman is often considered a go-to cocktail for those who want a festive drink without alcohol.\n","-------------------\n","Pito is a traditional West African beer made from fermented cereal grains, commonly sorghum or millet. It is brewed in countries like Ghana and Nigeria by first malting the grains, then boiling and fermenting them. The resulting drink is a cloudy, light-brown beer with a sour, yeasty flavor and a low to moderate alcohol content. Often home-brewed and sold locally (sometimes in calabash gourds), pito is enjoyed at communal gatherings and festivals.\n","-------------------\n","Ataya (Attaya) is a strong green tea ritual popular in West African countries like Senegal, Gambia, and Mauritania. Gunpowder green tea is brewed and repeatedly poured between small glasses to create foam, then heavily sweetened with sugar. Served in three rounds (each glass often stronger or more bitter than the last), ataya is as much about the social ceremony and time spent with friends as it is about the tea itself.\n","-------------------\n","Bouye is a creamy, sweet drink made from the fruit of the baobab tree, popular in West African countries like Senegal. The baobab fruit pulp is soaked and dissolved in water, then mixed with milk or sugar to create a smooth beverage. It has a pale color and a tangy, slightly pear-like or citrusy taste. Served cold, bouye is both refreshing and nutritious, as baobab fruit is rich in vitamins.\n","-------------------\n","Ethiopian coffee isn't just a drink but part of a ceremonial experience in Ethiopia. Coffee beans are roasted over a fire, then ground and brewed in a traditional clay pot called a jebena. The result is a strong, rich coffee often served in small cups and sometimes flavored with spices like cardamom or served alongside popcorn. The Ethiopian coffee ceremony involves multiple rounds of pouring, emphasizing hospitality and community.\n","-------------------\n","Mohammed was hungry so he went looking for a hearty plate of Shakshuka, drawn by the spicy aroma of poached eggs simmering in a rich tomato and pepper sauce at a bustling café.\n","-------------------\n","Aisha was hungry so she went looking for a bowl of Ful medames, lured by the savory scent of slow-cooked fava beans stewed in olive oil and lemon juice at her local eatery.\n","-------------------\n","Tunde was hungry so he went looking for crispy Akara, the deep-fried bean fritters that a street vendor was preparing with freshly blended black-eyed peas, onions, and spices.\n","-------------------\n","Nia was hungry so she went looking for warm Mandazi, tempted by the sweet, aromatic scent of freshly fried dough buns spiced with cardamom at a neighborhood bakery.\n","-------------------\n","Samuel was hungry so he went looking for a serving of Bobotie, guided by the enticing aroma of curried minced meat baked with a creamy egg topping at a family-run restaurant.\n","-------------------\n","Aminata was hungry so she went looking for a bowl of Harira, enticed by the robust flavors of a tomato-based soup simmered with lentils, chickpeas, and tender meat in a cozy eatery.\n","-------------------\n","Kwesi was hungry so he went looking for Doro Wat, captivated by the deep, aromatic spices of an Ethiopian chicken stew simmered to perfection and served with injera at a local diner.\n","-------------------\n","Zainab was hungry so she went looking for sambusa, lured by the crispy, savory pastries stuffed with spiced meat and vegetables freshly made by a street vendor in the busy market.\n","-------------------\n","Ibrahim was hungry so he went looking for dodo, the crispy fried plantains that perfectly accompanied the hearty stew he craved at a small roadside diner.\n","-------------------\n","Yara was thirsty so she went looking for Fura da nono, a traditional West African drink blending fermented milk with millet dough, offering a refreshing and tangy remedy on a hot day.\n","-------------------\n","Kenyan chai is a milky, spiced tea enjoyed commonly in East Africa. Black tea leaves are boiled with water, milk, and sugar, often along with spices such as ginger, cinnamon, or cardamom (similar to masala chai). The result is a hot, creamy tea with a comforting aroma and a balance of sweet and spicy flavors. It’s typically served in mugs and enjoyed at breakfast or any time of day as a soothing drink.\n","-------------------\n","Tej is a traditional Ethiopian honey wine (mead). It is made by fermenting honey with water and the leaves or bark of a plant called gesho, which acts as a natural yeast and adds a slight bitter note. The result is a golden, sweet wine with varying alcohol strength, often home-brewed. Tej is typically served in a rounded vase-like glass called a berele and is a customary drink at Ethiopian festivities.\n","-------------------\n","Tella is a home-brewed beer from Ethiopia, made from grains such as teff, barley, or sorghum, and fermented with the help of gesho (a local hop-like herb). The process involves malting the grain, brewing it with water and gesho, and allowing it to ferment for several days. Tella is usually dark, cloudy, and has a mildly sour, malty taste with low to moderate alcohol content. It is often brewed for local celebrations and social gatherings.\n","-------------------\n","Mursik is a traditional fermented milk beverage from Kenya, particularly among the Kalenjin community. Fresh cow's milk is stored in a special gourd that has been treated with burnt herbs, which lends a unique smoky flavor to the fermenting milk. Over several days, the milk turns into a thick, sour yogurt-like drink. Mursik is often consumed during ceremonies or after intense activities, valued for its refreshing and nutritious qualities.\n","-------------------\n","Dawa is a popular cocktail in Kenya, with a name that means \"medicine\" in Swahili, hinting at its soothing effect. The drink is made by muddling lime wedges with honey, then adding vodka and crushed ice. It is typically served with a stick (often coated in honey) used to stir and dissolve the honey. Tangy, sweet, and strong, the Dawa cocktail is a staple in many Kenyan bars and restaurants.\n","-------------------\n","Urwagwa is a traditional Rwandan beer made from fermented bananas. Ripe bananas are mashed and mixed with water, and sometimes sorghum or millet flour is added to introduce wild yeast for fermentation. After fermenting for a few days, the mixture turns into a mildly alcoholic beverage with a sweet and yeasty flavor. Urwagwa is often brewed for community events and celebrations, served in gourds or bottles among friends and family.\n","-------------------\n","Camel milk is a staple beverage for many nomadic communities in East Africa (and parts of North Africa). It is usually consumed fresh and is prized for its nutritional value. Camel milk has a taste similar to cow’s milk but slightly saltier and sometimes described as having a faint sweetness. Rich in vitamins and minerals, it can be drunk plain or used in tea and other preparations, providing hydration and nourishment in arid regions.\n","-------------------\n","Moroccan mint tea is a green tea brewed with fresh spearmint leaves and plenty of sugar, a symbol of hospitality in North Africa. The tea is traditionally prepared by steeping gunpowder green tea and mint in boiling water, then pouring it from a height into small glasses to create a light foam. The result is a hot, sweet, and refreshing drink with a strong minty aroma, enjoyed throughout the day and often offered to guests upon arrival.\n","-------------------\n","Karkadé is a popular hibiscus tea in Egypt and Sudan, made from dried hibiscus flower petals. When boiled, the petals turn the water a deep ruby red; sugar is added to balance the natural tartness, yielding a sweet-tart flavor similar to cranberry juice. Karkadé can be served chilled over ice as a refreshing drink or enjoyed warm. It’s commonly served during festivities and also as a daily thirst-quencher, appreciated for its vibrant taste and color.\n","-------------------\n","Sugarcane juice is a naturally sweet drink made by crushing sugarcane stalks to extract the liquid. Popular in many African countries, especially in North and East Africa, vendors use presses to squeeze out the pale green juice on the spot. The juice is often strained and served cold, sometimes with a squeeze of lemon or ginger for extra zing. It’s a refreshing energy booster on hot days, offering a raw sugary taste with hints of grassiness from the cane.\n","-------------------\n","Rooibos tea is a naturally caffeine-free herbal tea from South Africa, made from the leaves of the rooibos (red bush) plant. The leaves are fermented and dried, giving them a reddish-brown color. When brewed, rooibos produces a warm, reddish infusion with a smooth, slightly sweet and nutty flavor. It’s often enjoyed plain or with milk and sugar, and is valued for its calming, antioxidant-rich properties.\n","-------------------\n","Umqombothi is a traditional Xhosa and Zulu beer from South Africa, brewed from maize (corn), maize malt, sorghum malt, yeast, and water. The beer is thick and opaque with a porridge-like consistency and a sour, yeasty taste. It has a low alcohol content and is rich in vitamin B. Umqombothi is usually brewed at home in large containers and served in a communal clay pot. It plays an important role in ceremonies and gatherings, where it's shared among family and friends.\n","-------------------\n","Mageu (Mahewu) is a non-alcoholic fermented maize drink popular in Southern Africa. It is made by fermenting thin porridge made from maize meal until it develops a slightly sour taste. The final product is a smooth, yogurt-like beverage that is often flavored with a bit of sugar. Mageu is usually served cold and is both refreshing and filling, commonly consumed as a nutritious drink or light meal.\n","-------------------\n","Amarula is a creamy liqueur from South Africa made from the fruit of the marula tree. The marula fruit is distilled into a spirit and then blended with cream and sugar, creating a sweet, silky drink. Amarula has a light caramel color and a taste reminiscent of caramel and fruit, with a hint of citrus from the marula. It is typically enjoyed neat over ice or used in cocktails and desserts. While it’s a commercial product, it’s deeply connected to the region where marula fruits are harvested.\n","-------------------\n","Amasi is a fermented milk drink popular in Southern Africa (known as maas in Afrikaans). Cow’s milk is allowed to ferment naturally in a container, turning into a thick, sour yogurt-like beverage. The result is a creamy, tart liquid with curds, similar to buttermilk. Amasi can be drunk plain or mixed with mealie meal (maize meal) to make a quick meal. It's valued both for its refreshing taste and its nutritional benefits.\n","-------------------\n","Cachupa is a hearty slow-cooked stew from Cape Verde, an island nation off West Africa. It is made with dried corn kernels (hominy) and beans as the base, slow simmered with ingredients like sweet potatoes, cassava, squash, and whichever meats or fish are available (often pork, sausage, or tuna). The stew is seasoned with herbs and sometimes a touch of paprika, resulting in a rich, comforting dish. Cachupa is considered Cape Verde’s national dish and is often enjoyed as a family meal, with leftovers refried for breakfast in a dish called Cachupa refogada.\n","-------------------\n","Jide felt an intense hunger after a long day of work. His stomach rumbled as he wandered the lively streets, following the enticing aroma of simmering tomatoes and spices. Soon, he arrived at a bustling food stall serving steaming hot Jollof rice, a meal that promised to fill his empty stomach.\n","-------------------\n","Kofi's hunger drove him to explore the local market. The scent of roasted melon seeds and simmering greens led him to a small eatery where a rich bowl of Egusi soup was being prepared. The hearty stew, filled with tender meat and local spices, promised to ease his hunger.\n","-------------------\n","After a busy morning, Amina felt the pangs of hunger and set out on a quest for a quick, flavorful meal. Her eyes caught a street vendor grilling skewers of spiced meat known as Suya, offering a perfect balance of heat and smoky flavor.\n","-------------------\n","Chinedu's hunger was matched only by his longing for comfort food. In a small village eatery, he found freshly pounded Fufu paired with a savory stew. Each bite filled him with warmth and reminded him of home.\n","-------------------\n","After a long day under the sun, Thabo's hunger led him to a local restaurant where the tangy aroma of marinated chicken in a lemon and onion sauce filled the air. The Chicken Yassa he ordered was both zesty and deeply satisfying.\n","-------------------\n","Zuri, parched from a long walk in the heat, searched for a refreshing drink. The vibrant red Bissap, made from steeped hibiscus flowers and lightly sweetened, quenched her thirst and revitalized her spirit.\n","-------------------\n","On a hot afternoon, Kofi, after hours in the fields, stumbled upon a gathering where freshly tapped Palm wine was being served. The sweet, slightly tangy drink offered instant relief and a taste of tradition.\n","-------------------\n","Following a strenuous day at the market, Amina sought out something cool to drink. She opted for a glass of homemade Ginger beer, whose spicy tang and fizz provided the perfect refreshment to quench her thirst.\n","-------------------\n","In the midst of a bustling village festival, Chinedu, feeling the oppressive heat, looked for a way to cool down. A friend handed him a glass of Kunu, a smooth, fermented millet beverage that offered instant relief.\n","-------------------\n","After a morning of hard labor, Thabo sought out the local tea vendor. He found a cup of Kenyan chai, rich and spiced with ginger and cardamom, that warmed him up and quenched his thirst on a cool day.\n","-------------------\n"]}]},{"cell_type":"markdown","metadata":{"id":"q-wtFwrL5_gn"},"source":["\n","**Step 2: Create ngrams out of words.**\n","\n","\n","\n","In order to create ngrams, we must first convert sentences into individual words. This is also called tokenization."]},{"cell_type":"code","execution_count":null,"metadata":{"id":"mns1I5yzx-kp","executionInfo":{"status":"ok","timestamp":1742987286699,"user_tz":0,"elapsed":2,"user":{"displayName":"Annie Qurat ul ain","userId":"16820876301816973135"}},"colab":{"base_uri":"https://localhost:8080/"},"outputId":"8462cd7c-da2f-4ca6-80e6-32dda96edafc"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["[\"Here's\", 'how', 'you', 'tokenize!', 'Simple,', \"isn't\", 'it?']"]},"metadata":{},"execution_count":4}],"source":["# Function to split sentences into individual words.\n","def split_text(text):\n","    return text.split()\n","\n","split_text(\"Here's how you tokenize! Simple, isn't it?\")"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"IJx9P17ox-kp","executionInfo":{"status":"ok","timestamp":1742987286702,"user_tz":0,"elapsed":3,"user":{"displayName":"Annie Qurat ul ain","userId":"16820876301816973135"}},"colab":{"base_uri":"https://localhost:8080/"},"outputId":"9914c9e1-63a2-4267-8f73-42590198d9e7"},"outputs":[{"output_type":"stream","name":"stdout","text":["Unigrams: ['Didier', 'Drogba,', 'a', 'name', 'that', 'resonates', 'with', 'football', 'fans', 'worldwide,']\n","Bigrams: ['Didier Drogba,', 'Drogba, a', 'a name', 'name that', 'that resonates', 'resonates with', 'with football', 'football fans', 'fans worldwide,', 'worldwide, is']\n","Trigrams: ['Didier Drogba, a', 'Drogba, a name', 'a name that', 'name that resonates', 'that resonates with', 'resonates with football', 'with football fans', 'football fans worldwide,', 'fans worldwide, is', 'worldwide, is an']\n"]}],"source":["#Let's look at some ngrams in our data\n","all_unigrams=[]\n","all_bigrams=[]\n","all_trigrams=[]\n","\n","def generate_ngrams(text, n):\n","    words = split_text(text)\n","    ngrams = [\" \".join(words[i:i+n]) for i in range(len(words) - n + 1)]\n","    return ngrams\n","\n","\n","for story in stories:\n","    all_unigrams.extend(generate_ngrams(story,1))\n","    all_bigrams.extend(generate_ngrams(story, 2))\n","    all_trigrams.extend(generate_ngrams(story, 3))\n","\n","\n","print(\"Unigrams:\",all_unigrams[:10])\n","print(\"Bigrams:\",all_bigrams[:10])\n","print(\"Trigrams:\",all_trigrams[:10])"]},{"cell_type":"markdown","source":["Let's see which n-grams appear most frequently."],"metadata":{"id":"esDTLIxaHmLA"}},{"cell_type":"code","execution_count":null,"metadata":{"id":"2azMP6I4x-kp","executionInfo":{"status":"ok","timestamp":1742987286704,"user_tz":0,"elapsed":2,"user":{"displayName":"Annie Qurat ul ain","userId":"16820876301816973135"}},"colab":{"base_uri":"https://localhost:8080/"},"outputId":"5c91e6b2-6ff3-4cd8-c2a1-74a24739c6d1"},"outputs":[{"output_type":"stream","name":"stdout","text":["Most common Bigrams\n","[('is a', 134), ('of the', 90), ('and the', 72), ('in the', 67), ('with a', 60), ('and a', 57), ('in a', 56), ('was a', 45), ('to the', 40), ('went looking', 39)]\n","Most common Trigrams\n","[('went looking for', 39), ('a symbol of', 23), ('he went looking', 20), ('she went looking', 19), ('looking for a', 18), ('was hungry so', 18), ('so she went', 17), ('so he went', 17), ('The result is', 17), ('result is a', 15)]\n"]}],"source":["bigram_counts = Counter(all_bigrams)\n","print(\"Most common Bigrams\")\n","print(bigram_counts.most_common(10))\n","\n","print(\"Most common Trigrams\")\n","trigram_counts=Counter(all_trigrams)\n","print(trigram_counts.most_common(10))"]},{"cell_type":"markdown","metadata":{"id":"tr5wOBnVx-kp"},"source":["\n","Let's create matrix with all the context sequences (ngrams) and next_word counts in our data. This gives us the numerator of the formula: $$ \\text{Count(A B)}$$"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"VZaL5Lu4x-kp","executionInfo":{"status":"ok","timestamp":1742987298627,"user_tz":0,"elapsed":11922,"user":{"displayName":"Annie Qurat ul ain","userId":"16820876301816973135"}},"colab":{"base_uri":"https://localhost:8080/","height":461},"outputId":"52452be7-6334-4bd1-96b5-8dd59347e465"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["            Didier Drogba,  Drogba, a  a name  name that  that resonates  \\\n","a                        1          0       0          0               0   \n","name                     0          1       0          0               0   \n","that                     0          0       2          0               0   \n","resonates                0          0       0          1               0   \n","means                    0          0       0          1               0   \n","...                    ...        ...     ...        ...             ...   \n","Chinedu,                 0          0       0          0               0   \n","oppressive               0          0       0          0               0   \n","friend                   0          0       0          0               0   \n","handed                   0          0       0          0               0   \n","vendor.                  0          0       0          0               0   \n","\n","            resonates with  with football  football fans  fans worldwide,  \\\n","a                        0              0              0                0   \n","name                     0              0              0                0   \n","that                     0              0              0                0   \n","resonates                0              0              0                0   \n","means                    0              0              0                0   \n","...                    ...            ...            ...              ...   \n","Chinedu,                 0              0              0                0   \n","oppressive               0              0              0                0   \n","friend                   0              0              0                0   \n","handed                   0              0              0                0   \n","vendor.                  0              0              0                0   \n","\n","            worldwide, is  ...  found a  chai, rich  and cardamom,  \\\n","a                       0  ...        0           0              0   \n","name                    0  ...        0           0              0   \n","that                    0  ...        0           0              1   \n","resonates               0  ...        0           0              0   \n","means                   0  ...        0           0              0   \n","...                   ...  ...      ...         ...            ...   \n","Chinedu,                0  ...        0           0              0   \n","oppressive              0  ...        0           0              0   \n","friend                  0  ...        0           0              0   \n","handed                  0  ...        0           0              0   \n","vendor.                 0  ...        0           0              0   \n","\n","            cardamom, that  warmed him  him up  up and  and quenched  \\\n","a                        0           0       0       0             0   \n","name                     0           0       0       0             0   \n","that                     0           0       0       0             0   \n","resonates                0           0       0       0             0   \n","means                    0           0       0       0             0   \n","...                    ...         ...     ...     ...           ...   \n","Chinedu,                 0           0       0       0             0   \n","oppressive               0           0       0       0             0   \n","friend                   0           0       0       0             0   \n","handed                   0           0       0       0             0   \n","vendor.                  0           0       0       0             0   \n","\n","            quenched his  his thirst  \n","a                      0           0  \n","name                   0           0  \n","that                   0           0  \n","resonates              0           0  \n","means                  0           0  \n","...                  ...         ...  \n","Chinedu,               0           0  \n","oppressive             0           0  \n","friend                 0           0  \n","handed                 0           0  \n","vendor.                0           0  \n","\n","[5292 rows x 13874 columns]"],"text/html":["\n","  <div id=\"df-8f550987-7d9f-47fd-bc40-8c744f4653bd\" class=\"colab-df-container\">\n","    <div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>Didier Drogba,</th>\n","      <th>Drogba, a</th>\n","      <th>a name</th>\n","      <th>name that</th>\n","      <th>that resonates</th>\n","      <th>resonates with</th>\n","      <th>with football</th>\n","      <th>football fans</th>\n","      <th>fans worldwide,</th>\n","      <th>worldwide, is</th>\n","      <th>...</th>\n","      <th>found a</th>\n","      <th>chai, rich</th>\n","      <th>and cardamom,</th>\n","      <th>cardamom, that</th>\n","      <th>warmed him</th>\n","      <th>him up</th>\n","      <th>up and</th>\n","      <th>and quenched</th>\n","      <th>quenched his</th>\n","      <th>his thirst</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>a</th>\n","      <td>1</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>...</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","    </tr>\n","    <tr>\n","      <th>name</th>\n","      <td>0</td>\n","      <td>1</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>...</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","    </tr>\n","    <tr>\n","      <th>that</th>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>2</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>...</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>1</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","    </tr>\n","    <tr>\n","      <th>resonates</th>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>1</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>...</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","    </tr>\n","    <tr>\n","      <th>means</th>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>1</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>...</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","    </tr>\n","    <tr>\n","      <th>...</th>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","    </tr>\n","    <tr>\n","      <th>Chinedu,</th>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>...</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","    </tr>\n","    <tr>\n","      <th>oppressive</th>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>...</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","    </tr>\n","    <tr>\n","      <th>friend</th>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>...</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","    </tr>\n","    <tr>\n","      <th>handed</th>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>...</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","    </tr>\n","    <tr>\n","      <th>vendor.</th>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>...</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>0</td>\n","    </tr>\n","  </tbody>\n","</table>\n","<p>5292 rows × 13874 columns</p>\n","</div>\n","    <div class=\"colab-df-buttons\">\n","\n","  <div class=\"colab-df-container\">\n","    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-8f550987-7d9f-47fd-bc40-8c744f4653bd')\"\n","            title=\"Convert this dataframe to an interactive table.\"\n","            style=\"display:none;\">\n","\n","  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n","    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n","  </svg>\n","    </button>\n","\n","  <style>\n","    .colab-df-container {\n","      display:flex;\n","      gap: 12px;\n","    }\n","\n","    .colab-df-convert {\n","      background-color: #E8F0FE;\n","      border: none;\n","      border-radius: 50%;\n","      cursor: pointer;\n","      display: none;\n","      fill: #1967D2;\n","      height: 32px;\n","      padding: 0 0 0 0;\n","      width: 32px;\n","    }\n","\n","    .colab-df-convert:hover {\n","      background-color: #E2EBFA;\n","      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n","      fill: #174EA6;\n","    }\n","\n","    .colab-df-buttons div {\n","      margin-bottom: 4px;\n","    }\n","\n","    [theme=dark] .colab-df-convert {\n","      background-color: #3B4455;\n","      fill: #D2E3FC;\n","    }\n","\n","    [theme=dark] .colab-df-convert:hover {\n","      background-color: #434B5C;\n","      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n","      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n","      fill: #FFFFFF;\n","    }\n","  </style>\n","\n","    <script>\n","      const buttonEl =\n","        document.querySelector('#df-8f550987-7d9f-47fd-bc40-8c744f4653bd button.colab-df-convert');\n","      buttonEl.style.display =\n","        google.colab.kernel.accessAllowed ? 'block' : 'none';\n","\n","      async function convertToInteractive(key) {\n","        const element = document.querySelector('#df-8f550987-7d9f-47fd-bc40-8c744f4653bd');\n","        const dataTable =\n","          await google.colab.kernel.invokeFunction('convertToInteractive',\n","                                                    [key], {});\n","        if (!dataTable) return;\n","\n","        const docLinkHtml = 'Like what you see? Visit the ' +\n","          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n","          + ' to learn more about interactive tables.';\n","        element.innerHTML = '';\n","        dataTable['output_type'] = 'display_data';\n","        await google.colab.output.renderOutput(dataTable, element);\n","        const docLink = document.createElement('div');\n","        docLink.innerHTML = docLinkHtml;\n","        element.appendChild(docLink);\n","      }\n","    </script>\n","  </div>\n","\n","\n","<div id=\"df-93254b18-a10d-40d3-9604-30c353c3eb5b\">\n","  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-93254b18-a10d-40d3-9604-30c353c3eb5b')\"\n","            title=\"Suggest charts\"\n","            style=\"display:none;\">\n","\n","<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n","     width=\"24px\">\n","    <g>\n","        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n","    </g>\n","</svg>\n","  </button>\n","\n","<style>\n","  .colab-df-quickchart {\n","      --bg-color: #E8F0FE;\n","      --fill-color: #1967D2;\n","      --hover-bg-color: #E2EBFA;\n","      --hover-fill-color: #174EA6;\n","      --disabled-fill-color: #AAA;\n","      --disabled-bg-color: #DDD;\n","  }\n","\n","  [theme=dark] .colab-df-quickchart {\n","      --bg-color: #3B4455;\n","      --fill-color: #D2E3FC;\n","      --hover-bg-color: #434B5C;\n","      --hover-fill-color: #FFFFFF;\n","      --disabled-bg-color: #3B4455;\n","      --disabled-fill-color: #666;\n","  }\n","\n","  .colab-df-quickchart {\n","    background-color: var(--bg-color);\n","    border: none;\n","    border-radius: 50%;\n","    cursor: pointer;\n","    display: none;\n","    fill: var(--fill-color);\n","    height: 32px;\n","    padding: 0;\n","    width: 32px;\n","  }\n","\n","  .colab-df-quickchart:hover {\n","    background-color: var(--hover-bg-color);\n","    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n","    fill: var(--button-hover-fill-color);\n","  }\n","\n","  .colab-df-quickchart-complete:disabled,\n","  .colab-df-quickchart-complete:disabled:hover {\n","    background-color: var(--disabled-bg-color);\n","    fill: var(--disabled-fill-color);\n","    box-shadow: none;\n","  }\n","\n","  .colab-df-spinner {\n","    border: 2px solid var(--fill-color);\n","    border-color: transparent;\n","    border-bottom-color: var(--fill-color);\n","    animation:\n","      spin 1s steps(1) infinite;\n","  }\n","\n","  @keyframes spin {\n","    0% {\n","      border-color: transparent;\n","      border-bottom-color: var(--fill-color);\n","      border-left-color: var(--fill-color);\n","    }\n","    20% {\n","      border-color: transparent;\n","      border-left-color: var(--fill-color);\n","      border-top-color: var(--fill-color);\n","    }\n","    30% {\n","      border-color: transparent;\n","      border-left-color: var(--fill-color);\n","      border-top-color: var(--fill-color);\n","      border-right-color: var(--fill-color);\n","    }\n","    40% {\n","      border-color: transparent;\n","      border-right-color: var(--fill-color);\n","      border-top-color: var(--fill-color);\n","    }\n","    60% {\n","      border-color: transparent;\n","      border-right-color: var(--fill-color);\n","    }\n","    80% {\n","      border-color: transparent;\n","      border-right-color: var(--fill-color);\n","      border-bottom-color: var(--fill-color);\n","    }\n","    90% {\n","      border-color: transparent;\n","      border-bottom-color: var(--fill-color);\n","    }\n","  }\n","</style>\n","\n","  <script>\n","    async function quickchart(key) {\n","      const quickchartButtonEl =\n","        document.querySelector('#' + key + ' button');\n","      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n","      quickchartButtonEl.classList.add('colab-df-spinner');\n","      try {\n","        const charts = await google.colab.kernel.invokeFunction(\n","            'suggestCharts', [key], {});\n","      } catch (error) {\n","        console.error('Error during call to suggestCharts:', error);\n","      }\n","      quickchartButtonEl.classList.remove('colab-df-spinner');\n","      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n","    }\n","    (() => {\n","      let quickchartButtonEl =\n","        document.querySelector('#df-93254b18-a10d-40d3-9604-30c353c3eb5b button');\n","      quickchartButtonEl.style.display =\n","        google.colab.kernel.accessAllowed ? 'block' : 'none';\n","    })();\n","  </script>\n","</div>\n","\n","  <div id=\"id_09ae2eeb-bd78-4b6b-a947-b72575dabbd3\">\n","    <style>\n","      .colab-df-generate {\n","        background-color: #E8F0FE;\n","        border: none;\n","        border-radius: 50%;\n","        cursor: pointer;\n","        display: none;\n","        fill: #1967D2;\n","        height: 32px;\n","        padding: 0 0 0 0;\n","        width: 32px;\n","      }\n","\n","      .colab-df-generate:hover {\n","        background-color: #E2EBFA;\n","        box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n","        fill: #174EA6;\n","      }\n","\n","      [theme=dark] .colab-df-generate {\n","        background-color: #3B4455;\n","        fill: #D2E3FC;\n","      }\n","\n","      [theme=dark] .colab-df-generate:hover {\n","        background-color: #434B5C;\n","        box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n","        filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n","        fill: #FFFFFF;\n","      }\n","    </style>\n","    <button class=\"colab-df-generate\" onclick=\"generateWithVariable('df')\"\n","            title=\"Generate code using this dataframe.\"\n","            style=\"display:none;\">\n","\n","  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n","       width=\"24px\">\n","    <path d=\"M7,19H8.4L18.45,9,17,7.55,7,17.6ZM5,21V16.75L18.45,3.32a2,2,0,0,1,2.83,0l1.4,1.43a1.91,1.91,0,0,1,.58,1.4,1.91,1.91,0,0,1-.58,1.4L9.25,21ZM18.45,9,17,7.55Zm-12,3A5.31,5.31,0,0,0,4.9,8.1,5.31,5.31,0,0,0,1,6.5,5.31,5.31,0,0,0,4.9,4.9,5.31,5.31,0,0,0,6.5,1,5.31,5.31,0,0,0,8.1,4.9,5.31,5.31,0,0,0,12,6.5,5.46,5.46,0,0,0,6.5,12Z\"/>\n","  </svg>\n","    </button>\n","    <script>\n","      (() => {\n","      const buttonEl =\n","        document.querySelector('#id_09ae2eeb-bd78-4b6b-a947-b72575dabbd3 button.colab-df-generate');\n","      buttonEl.style.display =\n","        google.colab.kernel.accessAllowed ? 'block' : 'none';\n","\n","      buttonEl.onclick = () => {\n","        google.colab.notebook.generateWithVariable('df');\n","      }\n","      })();\n","    </script>\n","  </div>\n","\n","    </div>\n","  </div>\n"],"application/vnd.google.colaboratory.intrinsic+json":{"type":"dataframe","variable_name":"df"}},"metadata":{},"execution_count":7}],"source":["def get_ngram_count_matrix(stories, n):\n","    ngram_counts = defaultdict(Counter)\n","\n","    for story in stories:\n","        for ngram in generate_ngrams(story, n+1):\n","            words = split_text(ngram)\n","            context = \" \".join(words[:-1])\n","            next_word = words[-1]\n","            # if context not in ngram_counts:\n","            #     ngram_counts[context] = defaultdict(int)\n","            ngram_counts[context][next_word] += 1\n","\n","\n","    matrix_data = {context: dict(ngram_counts[context]) for context in ngram_counts}\n","\n","    # Convert to DataFrame and fill missing values with 0\n","    df = pd.DataFrame(matrix_data).fillna(0).astype(int)\n","\n","\n","    return ngram_counts,df\n","#let's look at counts of bigrams\n","ngram_counts,df=get_ngram_count_matrix(stories,2)\n","df"]},{"cell_type":"markdown","source":["\n","\n","**Step 3: Calculate $${\\text{Count(A)}} $$**\n","Based on our formula, dividing these ngram counts by the total count of words in context (Step 3) will give us the conditional probabilities we're after.\n","\n","\n","Remember the conditional probability formula:\n","\n","$$ P(\\text{B} \\mid \\text{A}) = \\frac{\\text{Count(A B)}}{\\text{Count(A)}} $$\n","\n","\n","Let's do that now!"],"metadata":{"id":"76CwEsOfsHv2"}},{"cell_type":"code","execution_count":null,"metadata":{"id":"isbFiZ2EyyO4","executionInfo":{"status":"ok","timestamp":1742987298628,"user_tz":0,"elapsed":5,"user":{"displayName":"Annie Qurat ul ain","userId":"16820876301816973135"}},"colab":{"base_uri":"https://localhost:8080/"},"outputId":"57dcf5b9-d836-4f4c-e4c8-7c38babd522c"},"outputs":[{"output_type":"stream","name":"stdout","text":["Didier Drogba,: {'a': 1.0}\n","Drogba, a: {'name': 1.0}\n","a name: {'that': 1.0}\n","name that: {'resonates': 0.5, 'means': 0.5}\n","that resonates: {'with': 1.0}\n"]}],"source":["def build_ngram_model(ngram_counts, n):\n","    # Convert counts to probabilities\n","    ngram_model = {}\n","    for context, next_words in ngram_counts.items():\n","        total_count = sum(next_words.values())\n","        ngram_model[context] = {word: count / total_count for word, count in next_words.items()}\n","\n","    return ngram_model\n","\n","ngram_model = build_ngram_model(ngram_counts,2)\n","\n","# Let's look at a few probabilities in our ngram model\n","sample_keys = list(ngram_model.keys())[:5]\n","for key in sample_keys:\n","    print(f\"{key}: {ngram_model[key]}\")"]},{"cell_type":"markdown","source":["\n","Let's understand the datatype of our ngram model. Our ngram model is a dictionary where:\n","\n","- Keys: Represent the context (for example, a unigram \"for\", or bigram \"looking for\").\n","\n","- Values: Represent another dictionary, keys of which are all candidates words observed in our dataset and values are their probabilities.\n","\n","Below is an example of a dictionary within a dictionary.\n"],"metadata":{"id":"tu2h5vcYhOG-"}},{"cell_type":"code","source":["# Example: A dictionary of student grades\n","student_grades = {\n","    'Annie': {\n","        'Math': 95,\n","        'Science': 88,\n","        'History': 92\n","    },\n","    'Teju': {\n","        'Math': 85,\n","        'Science': 90,\n","        'History': 80\n","    }\n","}\n","\n","# Accessing the dictionary for Teju\n","teju_grades = student_grades['Teju']\n","print(\"Teju's grades:\", teju_grades)\n","\n","# Extracting the subjects (keys) for Teju\n","subjects = list(teju_grades.keys())\n","print(\"Subjects for Teju:\", subjects)\n","\n","# Extracting the grades (values) for Teju\n","grades = list(teju_grades.values())\n","print(\"Grades for Teju:\", grades)\n"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"VnIIWTRrY8CA","executionInfo":{"status":"ok","timestamp":1742988843178,"user_tz":0,"elapsed":10,"user":{"displayName":"Annie Qurat ul ain","userId":"16820876301816973135"}},"outputId":"a459429b-7b2d-433c-dd03-8f89c37504b9"},"execution_count":null,"outputs":[{"output_type":"stream","name":"stdout","text":["Teju's grades: {'Math': 85, 'Science': 90, 'History': 80}\n","Subjects for Teju: ['Math', 'Science', 'History']\n","Grades for Teju: [85, 90, 80]\n"]}]},{"cell_type":"code","source":["#Using our model, for the context 'looking for', the result is another dictionary\n","#with candidate words as keys and their probabilities as values.\n","ngram_model['looking for']"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"GW84miR7Qu9k","executionInfo":{"status":"ok","timestamp":1742988856284,"user_tz":0,"elapsed":37,"user":{"displayName":"Annie Qurat ul ain","userId":"16820876301816973135"}},"outputId":"8f1ad2fb-461f-480b-968f-e73d4df6c9d1"},"execution_count":null,"outputs":[{"output_type":"execute_result","data":{"text/plain":["{'the': 0.15384615384615385,\n"," 'anything': 0.02564102564102564,\n"," 'alternative': 0.02564102564102564,\n"," 'scraps': 0.02564102564102564,\n"," 'any': 0.02564102564102564,\n"," 'a': 0.46153846153846156,\n"," 'Banku': 0.02564102564102564,\n"," 'Tella,': 0.02564102564102564,\n"," 'Maafe,': 0.02564102564102564,\n"," 'Umqombothi,': 0.02564102564102564,\n"," 'sugarcane': 0.02564102564102564,\n"," 'crispy': 0.02564102564102564,\n"," 'warm': 0.02564102564102564,\n"," 'Doro': 0.02564102564102564,\n"," 'sambusa,': 0.02564102564102564,\n"," 'dodo,': 0.02564102564102564,\n"," 'Fura': 0.02564102564102564}"]},"metadata":{},"execution_count":14}]},{"cell_type":"markdown","source":["### Coding exercise:\n","\n","Now, we need to write the code to predict the next word based on a given context.  We used `random.choices` in the previous course to randomly select an candidate word from a list based on specified weights (probabilities). We'll use it again here. In the previous course, the probabilities came from your mental model of english, this time around the probabilities will be based on the n-grams we have observed in our dataset. As a refresher, below is a sample usage of `random.choices`.\n"],"metadata":{"id":"py8WlM2ARNhZ"}},{"cell_type":"code","source":["import random\n","\n","# Define a list of items\n","sample_candidate_words = ['apple', 'banana', 'cherry']\n","\n","# Define corresponding weights for each fruit\n","# The probability of choosing each fruit is proportional to its weight.\n","weights = [0.2, 0.5, 0.3]\n","\n","# Sample one fruit based on the weights.\n","# The 'k=1' parameter indicates that we're selecting one item.\n","chosen_fruit = random.choices(sample_candidate_words, weights=weights, k=1)[0]\n","\n","print(\"Chosen fruit:\", chosen_fruit)\n"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"qNHq3vS1Rj8m","executionInfo":{"status":"ok","timestamp":1742988901147,"user_tz":0,"elapsed":44,"user":{"displayName":"Annie Qurat ul ain","userId":"16820876301816973135"}},"outputId":"18ad9547-3d5f-41f6-a764-2721d5d3ba82"},"execution_count":null,"outputs":[{"output_type":"stream","name":"stdout","text":["Chosen fruit: apple\n"]}]},{"cell_type":"markdown","source":["\n","To use random choice for the context \"looking for\". You need to write code that performs the following steps:\n","\n","Step 1: Extract candidate words for a given context from the ngram_model using the .keys() method.\n","\n","Step 2: Extract the corresponding probability weights using the .values() method."],"metadata":{"id":"CzOxiLBJI_Hv"}},{"cell_type":"markdown","source":["Step 1"],"metadata":{"id":"Ba69l0KSVcFX"}},{"cell_type":"code","source":["context = \"looking for\"\n","candidate_words=#enter code here\n","candidate_words"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"zBgdyD0XVa3A","executionInfo":{"status":"ok","timestamp":1742990161409,"user_tz":0,"elapsed":14,"user":{"displayName":"Annie Qurat ul ain","userId":"16820876301816973135"}},"outputId":"f8819a15-1e91-49d6-e0cd-ba0d1c4d8cad"},"execution_count":null,"outputs":[{"output_type":"execute_result","data":{"text/plain":["dict_keys(['the', 'anything', 'alternative', 'scraps', 'any', 'a', 'Banku', 'Tella,', 'Maafe,', 'Umqombothi,', 'sugarcane', 'crispy', 'warm', 'Doro', 'sambusa,', 'dodo,', 'Fura'])"]},"metadata":{},"execution_count":33}]},{"cell_type":"code","source":["# @title Run me to test your code or get a hint. (Try not to peek this code until you've given it a good try!)\n","def test_candidate_words():\n","  hint = \"\"\"\n","        Hint:\n","        ======\n","        The ngram model is a dictionary where each context maps to another dictionary of candidate words.\n","        To get a list of candidate words for a specific context, put the context in the model as ngram_model[context] and then use the .keys() method.\n","   \"\"\"\n","  context = \"looking for\"\n","\n","  try:\n","    if candidate_words==ngram_model[context].keys():\n","      print(\"Nice! Your answer looks correct.\")\n","    else:\n","      print(\"\\033[1m\\033[91mSorry, your answer is not correct.\\033[0m\")\n","      give_hints = input(\"Would you like a hint? type Yes or No \")\n","      if give_hints.lower() in ['yes', \"y\"]:\n","        print(f\"{hint}\")\n","  except NameError:\n","          print(\"Hint: The variable 'candidate_words' is not defined.\")\n","          print(\"You need to write some code after candidate_words=\")\n","\n","test_candidate_words()"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"vUoxsVyS7xmn","executionInfo":{"status":"ok","timestamp":1742989984496,"user_tz":0,"elapsed":10,"user":{"displayName":"Annie Qurat ul ain","userId":"16820876301816973135"}},"outputId":"6f803dfe-a140-4810-b606-5033019a918d","cellView":"form"},"execution_count":null,"outputs":[{"output_type":"stream","name":"stdout","text":["Hint: The variable 'candidate_words' is not defined.\n","You need to write some code after candidate_words=\n"]}]},{"cell_type":"markdown","source":["Step 2"],"metadata":{"id":"NKbYdOfmVlZD"}},{"cell_type":"code","source":["context = \"looking for\"\n","weights = #enter code here\n","weights"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"V2WHQjstVnQQ","executionInfo":{"status":"ok","timestamp":1742990132593,"user_tz":0,"elapsed":15,"user":{"displayName":"Annie Qurat ul ain","userId":"16820876301816973135"}},"outputId":"95931bdb-cfd3-4d5f-f8b9-0fe1983f69dc"},"execution_count":null,"outputs":[{"output_type":"execute_result","data":{"text/plain":["dict_values([0.15384615384615385, 0.02564102564102564, 0.02564102564102564, 0.02564102564102564, 0.02564102564102564, 0.46153846153846156, 0.02564102564102564, 0.02564102564102564, 0.02564102564102564, 0.02564102564102564, 0.02564102564102564, 0.02564102564102564, 0.02564102564102564, 0.02564102564102564, 0.02564102564102564, 0.02564102564102564, 0.02564102564102564])"]},"metadata":{},"execution_count":32}]},{"cell_type":"code","source":["# @title Run me to test your code or get a hint. (Try not to peek this code until you've given it a good try!')\n","def test_weights():\n","  hint = \"\"\"\n","        Hint:\n","        ======\n","        This is the same as the step above except this time around we are fetching the values, not keys. Try using .values() instead of .keys().\n","    \"\"\"\n","\n","  try:\n","    if list(weights) == list(ngram_model[context].values()):\n","      print(\"Nice! Your answer looks correct.\")\n","    else:\n","      print(\"\\033[1m\\033[91mSorry, your answer is not correct.\\033[0m\")\n","      give_hints = input(\"Would you like a hint? type Yes or No \")\n","      if give_hints.lower() in ['yes', \"y\"]:\n","        print(f\"{hint}\")\n","  except NameError:\n","          print(\"Hint: The variable 'weights' is not defined.\")\n","          print(\"You need to write some code after weights=\")\n","\n","\n","test_weights()"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"cellView":"form","id":"oKZlBxziX13g","executionInfo":{"status":"ok","timestamp":1742990129377,"user_tz":0,"elapsed":8,"user":{"displayName":"Annie Qurat ul ain","userId":"16820876301816973135"}},"outputId":"ac90d24c-6ba6-4453-d0dc-de475496c3ab"},"execution_count":null,"outputs":[{"output_type":"stream","name":"stdout","text":["Nice! Your answer looks correct.\n"]}]},{"cell_type":"markdown","source":["Let's put these in random.choices and generate a next possible word.\n"],"metadata":{"id":"2Iq1yH1kVvHQ"}},{"cell_type":"code","source":["context = \"looking for\"\n","random.choices(list(candidate_words),weights=weights)[0]"],"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":36},"id":"6UOC_uQBVv8L","executionInfo":{"status":"ok","timestamp":1742990332557,"user_tz":0,"elapsed":5,"user":{"displayName":"Annie Qurat ul ain","userId":"16820876301816973135"}},"outputId":"f736062f-aca9-4fd8-8515-fca561a117ac"},"execution_count":null,"outputs":[{"output_type":"execute_result","data":{"text/plain":["'the'"],"application/vnd.google.colaboratory.intrinsic+json":{"type":"string"}},"metadata":{},"execution_count":41}]},{"cell_type":"markdown","source":["Coding activity finished."],"metadata":{"id":"EvnHDS49bYb_"}},{"cell_type":"markdown","metadata":{"id":"oCoGHege65Z1"},"source":["\n","\n","\n","**Step 4: Generate text**\n","\n","Now that we have a probability distribution over ngrams, let's use that to generate the next words given a prompt.\n","A prompt can be any phrase or word you want to give the model as a context or a starting point. A model can generate language by randomly selecting the next word based on their probabilities conditioned on preceding words (context) in the prompt. This is a simple but effective method for creating text that resembles the source material used to train the model.\n","\n","\n","\n"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"uenGa3b4iHBo"},"outputs":[],"source":["def generate_next_n_words(ngram_model, prompt, num_next_words, ngram):\n","\n","    generated_words = split_text(prompt)  #split prompt into individual words\n","\n","    for _ in range(num_next_words):\n","        context = generated_words[-(ngram):]  # Get last (n) words\n","        context = \" \".join(context)\n","        if context in ngram_model:\n","            # Sample next word based on probabilities\n","            next_word = random.choices(\n","                list(ngram_model[context].keys()),\n","                weights=ngram_model[context].values()\n","            )[0]\n","\n","            generated_words.append(next_word)\n","        else:\n","            print(\"No valid continuation found. Change the prompt or try a smaller ngram\")  # Show when no next word is found\n","            break  # Stop if no valid continuation exists\n","\n","    return \" \".join(generated_words)"]},{"cell_type":"markdown","metadata":{"id":"Mg6OcRJm9r9P"},"source":["1. Run the following cell multiple times to see different results.\n","2. Try a simpler prompt, preferably one that uses phrases from the training data.\n","3. Try different values of n\n","\n","\n","\n"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"xndDil588L39","executionInfo":{"status":"ok","timestamp":1742990349274,"user_tz":0,"elapsed":14,"user":{"displayName":"Annie Qurat ul ain","userId":"16820876301816973135"}},"colab":{"base_uri":"https://localhost:8080/","height":36},"outputId":"60a84e44-4a63-4f8f-d9d0-a2c48ce554b0"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["'Jide was hungry so she went looking for Maafe, a rich palm nut soup from southern Nigeria. It'"],"application/vnd.google.colaboratory.intrinsic+json":{"type":"string"}},"metadata":{},"execution_count":44}],"source":["prompt=\"Jide was hungry so she went looking for\"\n","\n","n =2\n","num_next_words = 10 #generate next n words\n","generate_next_n_words(ngram_model,prompt,num_next_words,n)"]},{"cell_type":"markdown","metadata":{"id":"Oz0MoqxB96S_"},"source":["The different results when running the cell multiple times are because the n-gram model picks the next word from a probability distribution randomly (also called *sampling*). More probable next words have a high probability of getting picked but are not guarenteed to be picked. This gives the output its stochasticity. Stochasticity means randomness or chance."]},{"cell_type":"markdown","source":["**What happens if you increase the context window i.e. the n in n-grams?**\n","\n","Increasing the context window significantly impacts the ability to build a robust language model.  While it intuitively seems that a larger context (higher n) would lead to better accuracy by capturing more long-range dependencies in language,  it quickly runs into the problem of data sparsity (i.e. high dimensional array with many zero values).\n","\n","With higher-order n-grams, the number of possible n-gram combinations explodes.  For example, moving from bigrams (n=2) to trigrams (n=3) drastically increases the possible combinations.  Even with massive datasets, many of these higher-order n-grams will never appear in the training corpus.  This results in many zero counts for the probabilities, making it impossible to estimate probabilities directly because P(w|context) = 0 if the specific n-gram (w, context) wasn't seen in the training data. Even though, advanced techniques like smoothing exist, the accuracy gains from a larger context window may not always outweigh the computational cost and potential for error introduced by sparse data."],"metadata":{"id":"5cBF2OYCq8kr"}}]}